gather_attrs: Gather attributes from data frame variables

Description Usage Arguments Details Value See Also Examples

View source: R/gather_attrs.R

Description

gather_attrs moves variable-level attributes to the data frame level and spread_attrs reverses that operation.

Usage

1
2
3

Arguments

x

A data frame.

Details

import attempts to standardize the return value from the various import functions to the extent possible, thus providing a uniform data structure regardless of what import package or function is used. It achieves this by storing any optional variable-related attributes at the variable level (i.e., an attribute for mtcars$mpg is stored in attributes(mtcars$mpg) rather than attributes(mtcars)). gather_attrs moves these to the data frame level (i.e., in attributes(mtcars)). spread_attrs moves attributes back to the variable level.

Value

x, with variable-level attributes stored at the data frame level.

See Also

import, characterize

Examples

1
2
3
4
5
e <- import("http://www.stata-press.com/data/r13/auto.dta")
str(e)
g <- gather_attrs(e)
str(attributes(e))
str(g)

rio documentation built on June 20, 2017, 9:08 a.m.

Search within the rio package
Search all R packages, documentation and source code