| read_featuretable | R Documentation |
Basically a wrapper around readr::read_delim() but performs some initial tidying operations such as gather() rearranging columns. The label_col will be renamed to Feature.
read_featuretable(
file,
delim = ",",
label_col = 1,
metadata_cols = NULL,
remove_empty_cols = FALSE,
show_removed_cols = TRUE,
...
)
file |
A path to a file but can also be a connection or literal data. |
delim |
The field separator or delimiter. For example "," in csv files. |
label_col |
The index or name (as a character) of the column that will be used to label Features. For example an identifier (e.g., KEGG, CAS, HMDB) or a m/z-RT pair. |
metadata_cols |
The index/indices or name(s) of column(s) that hold additional feature metadata (e.g., retention times, additional identifiers or m/z values). |
remove_empty_cols |
Either |
show_removed_cols |
Only relevant if |
... |
Additional arguments passed on to |
A tidy tibble.
H. Wickham, J. Stat. Soft. 2014, 59, DOI 10.18637/jss.v059.i10.
H. Wickham, M. Averick, J. Bryan, W. Chang, L. McGowan, R. François, G. Grolemund, A. Hayes, L. Henry, J. Hester, M. Kuhn, T. Pedersen, E. Miller, S. Bache, K. Müller, J. Ooms, D. Robinson, D. Seidel, V. Spinu, K. Takahashi, D. Vaughan, C. Wilke, K. Woo, H. Yutani, JOSS 2019, 4, 1686, DOI 10.21105/joss.01686.
“12 Tidy data | R for Data Science,” can be found under https://r4ds.had.co.nz/tidy-data.html, 2023.
# Read a toy dataset in the format produced with Bruker MetaboScape (Version 2021).
featuretable_path <- system.file("extdata", "toy_metaboscape.csv", package = "metamorphr")
# Example 1: Provide indices for metadata_cols
featuretable <- read_featuretable(featuretable_path, metadata_cols = 2:5)
featuretable
# Example 2: Provide a name for label_col and indices for metadata_cols
featuretable <- read_featuretable(
featuretable_path,
label_col = "m/z",
metadata_cols = c(1, 2, 4, 5)
)
featuretable
# Example 3: Provide names for both, label_col and metadata_cols
featuretable <- read_featuretable(
featuretable_path,
label_col = "m/z",
metadata_cols = c("Bucket label", "RT", "Name", "Formula")
)
featuretable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.