dictionary {libr}R Documentation

Create a Data Dictionary

Description

A function to create a data dictionary for a data frame, a tibble, or a data library. The function will generate a tibble of information about the data. The tibble will contain the following columns:

Usage

dictionary(x)

Arguments

x

The input library, data frame, or tibble.

See Also

libname to create a data library. Also see the dsattr function to set attributes for your dataset from within a datastep. To render attributes, see the fmtr package.

Examples

# Create temp directory
tmp <- tempdir()

# Create library
libname(dat, tmp)

# Add data to the library
lib_add(dat, beaver1)
lib_add(dat, iris)

# Examine the dictionary for the library
dictionary(dat)
# A tibble: 9 x 10
#   Name    Column       Class   Label Description Format Width Justify  Rows   NAs MaxChar
#   <chr>   <chr>        <chr>   <lgl> <lgl>       <lgl>  <lgl> <lgl>   <int> <int>   <int>
# 1 beaver1 day          numeric NA    NA          NA     NA    NA        114     0       3
# 2 beaver1 time         numeric NA    NA          NA     NA    NA        114     0       4
# 3 beaver1 temp         numeric NA    NA          NA     NA    NA        114     0       5
# 4 beaver1 activ        numeric NA    NA          NA     NA    NA        114     0       1
# 5 iris    Sepal.Length numeric NA    NA          NA     NA    NA        150     0       3
# 6 iris    Sepal.Width  numeric NA    NA          NA     NA    NA        150     0       3
# 7 iris    Petal.Length numeric NA    NA          NA     NA    NA        150     0       3
# 8 iris    Petal.Width  numeric NA    NA          NA     NA    NA        150     0       3
# 9 iris    Species      factor  NA    NA          NA     NA    NA        150     0      10

# Clean up
lib_delete(dat)

[Package libr version 1.3.2 Index]