annotate.data.frame: annotate.data.frame

Description Usage Arguments Details Value Author(s)

View source: R/analysis.page.R

Description

Clean up and annotate a data frame

Usage

1
annotate.data.frame(obj, required.fields = c("x", "y"), signif.digits = 3)

Arguments

obj

data.frame or AnnotatedDataFrame: the return value of a handler.

required.fields

Character vector of required fields. Default: c("x","y"). You could set to character(0), for example, if you don't want to force a check that "x" and "y" be present.

signif.digits

Integer, default 3, giving the number of significant digits to which "numeric" (but not "integer") columns should be rounded, using signif(). NULL means to not round at all.

Details

The obj argument should be a return value from a handler, either a data.frame or an annotated data.frame. If a data.frame then an AnnotatedDataFrame is built. Then three special fields in varMetadata are checked: "labelDescription" and "type"

If any is missing then they are built as follows:

labelDescription

labelDescription always exists, but sometimes it has NA entries. In those cases it is set to the name of the variable (rowname of the varMetadata). This is the one that you most likely might want to set yourself.

type

If not present, then it is calculated from the pData like this: sapply(lapply(pData(obj), is), "[", 1). This will become one of "integer", "factor", "logical", "numeric" or "character", and the front end should know how to render these.

Columns that have type "numeric" (but not "integer") are rounded to the given number of significant digits.

Also, this throws an error if "x" or "y" field is missing

Value

AnnotatedDataFrame

Author(s)

Brad Friedman


AnalysisPageServer documentation built on April 28, 2020, 6:32 p.m.