Load raw data from disk and aggregate (using the mean function) observations with duplicated IDs (first column). Non-numeric columns must be excluded using the excluded_columns parameter.

Usage,
load_raw(raw_data_filename, excluded_columns = NULL)

Arguments

raw_data_filename

Filename containing the raw data, it can be a relative path (e.g. "my_input.csv") or an absolute path (e.g. "/path/to/my_input.csv").

excluded_columns

Numeric vector containing the indices of the dataset properties that are non-numeric, excluded columns.

Value

Data frame with the pre-processed raw data.

Examples

# Toy dataset
example_data <- data.frame(ID = c(1,2,3,4,5), 
                           P1 = c("one", "two", "three", "four", "five"), 
                           T1 = rnorm(5), 
                           T2 = rnorm(5))
write.csv(example_data, 
          file.path(tempdir(), "example_data.csv"), 
          row.names = FALSE)
write.csv(example_data[c(1:5, 1, 2), ], 
          file.path(tempdir(), "example_data_dup.csv"), 
          row.names = FALSE)
knitr::kable(MetaPipe::load_raw(file.path(tempdir(), "example_data.csv"), 
                                c(1, 2)))
#> 
#> 
#> | ID|P1    |         T1|         T2|
#> |--:|:-----|----------:|----------:|
#> |  1|one   | -1.1346302|  0.5904787|
#> |  2|two   |  0.7645571| -1.4130700|
#> |  3|three |  0.5707101|  1.6103416|
#> |  4|four  | -1.3516939|  1.8404425|
#> |  5|five  | -2.0298855|  1.3682979|
knitr::kable(MetaPipe::load_raw(file.path(tempdir(), "example_data_dup.csv"), 
                                c(1, 2)))
#> 
#> 
#> | ID|P1    |         T1|         T2|
#> |--:|:-----|----------:|----------:|
#> |  1|one   | -1.1346302|  0.5904787|
#> |  2|two   |  0.7645571| -1.4130700|
#> |  3|three |  0.5707101|  1.6103416|
#> |  4|four  | -1.3516939|  1.8404425|
#> |  5|five  | -2.0298855|  1.3682979|


# F1 Seedling Ionomics dataset
ionomics_path <- system.file("extdata", 
                             "ionomics.csv", 
                             package = "MetaPipe", 
                             mustWork = TRUE)
ionomics <- MetaPipe::load_raw(ionomics_path)
knitr::kable(ionomics[1:5, 1:8])
#> 
#> 
#> |ID    | SampleWeight|     Ca44|      K39|      P31|       Li7|      B11|      Na23|
#> |:-----|------------:|--------:|--------:|--------:|---------:|--------:|---------:|
#> |E_199 |           79| 32675.79| 6051.023| 2679.338| 0.1159068| 23.32975|  9.372606|
#> |E_209 |           81| 28467.95| 5642.651| 2075.403| 0.0104801| 27.31206|  8.787553|
#> |E_035 |           81| 27901.35| 7357.856| 2632.343| 0.0561879| 16.87480| 14.369062|
#> |E_197 |           79| 27855.36| 5225.275| 1761.725| 0.0104453| 25.34740| 11.009597|
#> |E_016 |           79| 27377.40| 6141.001| 2145.715| 0.0172996| 24.64500|  6.999958|