Learn R Programming

epifit (version 0.1.2)

showContents: Show variable information in data.frame

Description

Show variable information in data.frame.

Usage

showContents(data = NULL, functions = c(modes), na.action = "na.pass", na.omit.for.variable = TRUE, show.nobs = TRUE)

Arguments

data
a data.frame whose contents to be shown
functions
a vector of functions to be applied to each variable in data.frame. Default added function is mode, which is almost same functionality as storage.mode except that factor is separated from integer.
na.action
a character which specifies missing-data filter function. This is applied to data.frame supplied by data argument. Default is ‘na.pass’.
na.omit.for.variable
a logical value specifying whether to apply na.omit for each variable. This option is useful to supply NA free data to each function. When set to TRUE (default), the number of observation may differ for each variable, and it is recommended to check the number of obsevations by show.nobs option.
show.nobs
a logical valye specifying whether to add the number of observations for each function as nobs column in result object.

Value

a data.frame which contains the results of each function.

Details

This function shows contents in data.frame object, and typical use is to list modes of variables in data.frame. In addition to variable mode, a variety of functions can be used such as min, max and mean for summarizing variable information in data.frame.

See Also

countNA

Examples

Run this code
dat <- data.frame(a = rnorm(100))
dat <- transform(dat, b = ifelse(a > -2, a, NA))
dat <- transform(dat, c = ifelse(a > 0, "positive", "negative"))
showContents(dat)
showContents(dat, functions=c(modes, storage.mode, min, max, median))

Run the code above in your browser using DataLab