extract_metadata: Pull metadata from a table (xlsx/xls/csv/whatever)

View source: R/metadata.R

extract_metadataR Documentation

Pull metadata from a table (xlsx/xls/csv/whatever)

Description

I find that when I acquire metadata from a paper or collaborator, annoyingly often there are many special characters or other shenanigans in the column names. This function performs some simple sanitizations. In addition, if I give it a filename it calls my generic 'read_metadata()' function before sanitizing.

Usage

extract_metadata(
  metadata,
  id_column = "sampleid",
  fill = NULL,
  fill_condition = TRUE,
  fill_batch = TRUE,
  sanitize = TRUE,
  ...
)

Arguments

metadata

file or df of metadata

id_column

Column in the metadat containing the sample names.

fill

Fill missing data with this.

fill_condition

Add a condition column if there is not one?

fill_batch

Add a batch column if there is not one?

sanitize

Perform my various sanitizers on the data?

...

Arguments to pass to the child functions (read_csv etc).

Value

Metadata dataframe hopefully cleaned up to not be obnoxious.

Examples

 ## Not run: 
  sanitized <- extract_metadata("some_random_supplemental.xls")
  saniclean <- extract_metadata(some_goofy_df)

## End(Not run)

elsayed-lab/hpgltools documentation built on May 9, 2024, 5:02 a.m.