Learn R Programming

questionr (version 0.7.7)

describe: Describe the variables of a data.frame

Description

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

Usage

describe(x, ...)

# S3 method for factor describe(x, n = 10, show.length = TRUE, freq.n.max = 10, ...)

# S3 method for numeric describe(x, n = 10, show.length = TRUE, freq.n.max = 10, ...)

# S3 method for character describe(x, n = 10, show.length = TRUE, freq.n.max = 10, ...)

# S3 method for default describe(x, n = 10, show.length = TRUE, freq.n.max = 10, ...)

# S3 method for haven_labelled describe(x, n = 10, show.length = TRUE, freq.n.max = 10, ...)

# S3 method for data.frame describe(x, ..., n = 10, freq.n.max = 0)

# S3 method for description print(x, ...)

Value

an object of class description.

Arguments

x

object to describe

...

further arguments passed to or from other methods, see details

n

number of first values to display

show.length

display length of the vector?

freq.n.max

display a frequency table if the number of unique values is less than this value, 0 to hide

Author

Joseph Larmarange <joseph@larmarange.net>

Details

When describing a data.frame, you can provide variable names as character strings. Using the "*" or "|" wildcards in a variable name will search for it using a regex match. The search will also take into account variable labels, if any. See examples.

See Also

lookfor

Examples

Run this code
data(hdv2003)
describe(hdv2003$sexe)
describe(hdv2003$age)
describe(hdv2003)
describe(hdv2003, "cuisine", "heures.tv")
describe(hdv2003, "trav*")
describe(hdv2003, "trav|lecture")
describe(hdv2003, "trav", "lecture")

data(fertility)
describe(women$residency)
describe(women)
describe(women, "id")

Run the code above in your browser using DataLab