load_raw: Load raw data

View source: R/metapipe.R

load_rawR Documentation

Load raw data

Description

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, "example_data.csv", row.names = FALSE)
write.csv(example_data[c(1:5, 1, 2), ], 
          "example_data_dup.csv", 
          row.names = FALSE)
knitr::kable(MetaPipe::load_raw("example_data.csv", c(1, 2)))
knitr::kable(MetaPipe::load_raw("example_data_dup.csv", c(1, 2)))


# 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])

# Clean up example outputs
MetaPipe:::tidy_up("example_data")

villegar/MetaPipe documentation built on Nov. 22, 2022, 10:44 p.m.