Learn R Programming

questionr (version 0.2)

describe: Describe the variables of a dataset in R, SPSS or Stata formats

Description

This function describes the variables of a dataset that might include labels imported with the foreign or memisc packages.

Usage

describe(data, ...)

Arguments

data
dataset
...
variable names as character strings. Using the "*" or "|" wildcards in a variable name will search for it using a regex match.

Details

This function wraps around the description function of the memisc package and fetches the variable labels in datasets imported with the foreign package.

See Also

regex, description in the memisc package

Examples

Run this code
# Variables in a standard R data frame.
data(hdv2003)
# Find the names of selected variables.
describe(hdv2003, "age", "sexe", "lecture*", "frere|soeur")
# Load memisc package and example data.
require(memisc)
nes1948.por <- UnZip("anes/NES1948.ZIP","NES1948.POR", package="memisc")
nes1948 <- spss.portable.file(nes1948.por)
# Get the labels of selected variables.
describe(nes1948, "v480050", "version|set", "v48004*")

Run the code above in your browser using DataLab