Learn R Programming

RAM (version 1.2.1.3)

filter.META: Select METADATA Variables

Description

This function will remove metadata variables with only one level and /or remove variables with missing data or neither numeric nor factor/character (NNF).

Usage

filter.META(meta=meta, excl.na=TRUE, excl.NNF=TRUE, exclude=NULL)

Arguments

meta
the metadata table to be analyzed.
excl.na
logical. Whether or not remove variables that contain missing data.
excl.NNF
logical. Whether or not remove variables that neither are numeric nor factor/character.
exclude
optional. If is NULL, the function only removes variables with only one level or NNF. Otherwise, the variables in the exclude will also be removed from the metadata table.

Value

The value returned by this function is a data frame with the following metadata variables being removed: 1) with missing data; 2) NNF if excl.NNF is TRUE; and 3) in the exclude list.

Examples

Run this code
data(meta)
## Not run: 
# # add a new column with NA
# meta.nw <- meta
# meta.nw$na <- c(rep(NA, nrow(meta.nw)-3), c(1, 3, 5))
# meta.nw$nf <- rep("Canada", nrow(meta.nw))
# meta.fil <- filter.META(meta.nw)
# meta.fil <- filter.META(meta.nw, excl.na=FALSE, excl.NNF=FALSE,
#                         exclude=c("Province", "Latitude"))
# ## End(Not run)

Run the code above in your browser using DataLab