View source: R/RemoveNACases.R
RemoveNACases | R Documentation |
Function to remove the table rows for which all measurements of interest are non-available (NA). A particular list of measurement names can be explicitly provided or selected by a common initial pattern. The default setting removes the rows with no log-ratio available.
RemoveNACases(data, measureNames = NULL, prefix = logPrefix)
data |
A dataframe with the input measurements. |
measureNames |
A vector of characters with the list of measurements
to be considered for missing values. If |
prefix |
A character string with the initial pattern to select the
list of measurements. The default is given by the internal variable
|
A dataframe with the same columns as the input dataframe but removing the rows with missing values for all measurements in the list.
## Read an example dataset: dataFile <- system.file("extdata", "dataValenzuelaLamas2008.csv.gz", package = "zoolog") dataExample <- utils::read.csv2(dataFile, na.strings = "", encoding = "UTF-8") ## We can observe the first lines (excluding some columns for visibility): head(dataExample)[, -c(6:20,32:64)] ## Remove the cases not including any measurement present in the reference. refMeasureNames <- unique(reference$Combi$Measure) refMeasureNames dataExamplePruned <- RemoveNACases(dataExample, measureNames = refMeasureNames) ## The first lines of the output data frame show at least one available ## measurement value in the selected list: head(dataExamplePruned)[, -c(6:20,32:64)] ## If we compute first the log-ratios dataExampleWithLogs <- LogRatios(dataExample) ## the cases not including any log-ratio can be removed with the ## default logPrefix dataExampleWithLogsPruned <- RemoveNACases(dataExampleWithLogs) head(dataExampleWithLogsPruned)[, -c(6:20,32:64)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.