do.add.cols
Arguments
- dat
NO DEFAULT. A data.table (or data.frame) containing the data to have new values added to.
- base.col
NO DEFAULT. Name of the column containing values that new values will be matched to.
- add.dat
NO DEFAULT. A data table of new values to embed as a new columns, with one column containing values used for matching with the target data.table.
- add.by
NO DEFAULT. Character, name of the column in add.dat that is used for matching to the taret dataset.
- rmv.ext
DEFAULTS TO FALSE. Logical, can be TRUE or FALSE. Removes a ".csv" or ".fcs" extension from a the 'match.to' vector – especially useful if 'match.to' is a list of sample names that end in .csv or .fcs.
- mem.ctrl
DEFAULT = TRUE. Runs gc() (garbage collection) after a number of steps to free up memory that hasn't been released quickly enough.
Author
Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au
Examples
library(data.table)
dat <- Spectre::demo.clustered[,1:19]
add.dt <- data.table('Files' = unique(dat$FileName),
'SampleNumber' = c(1:12))
cell.dat <- do.add.cols(dat = dat,
base.col = "FileName",
add.dat = add.dt,
add.by = "Files")
#> Step 1/3. Mapping data
#> Step 2/3. Merging data
#> Step 3/3. Returning data