cb_get_col_attributes {codebookr}R Documentation

Get Column Attributes

Description

Used in codebook() to create the top half of the column attributes table.

Usage

cb_get_col_attributes(df, .x, keep_blank_attributes = keep_blank_attributes)

Arguments

df

Data frame of interest

.x

Column of interest in df

keep_blank_attributes

By default, the column attributes table will omit the Column description, Source information, Column type, and value labels rows from the column attributes table in the codebook document if those attributes haven't been set. In other words, it won't show blank rows for those attributes. Passing TRUE to the keep_blank_attributes argument will cause the opposite to happen. The column attributes table will include a Column description, Source information, Column type, and value labels row for every column in the data frame - even if they don't have a value.

Details

Typically, though not necessarily, the first step in creating your codebook will be to add column attributes to your data. The cb_add_col_attributes() function is a convenience function that allows you to add arbitrary attributes to columns (e.g., description, source, column type). These attributes can later be accessed to fill in the column attributes table of the codebook document. Column attributes can serve a similar function to variable labels in SAS or Stata; however, you can assign many different attributes to a column and they can contain any kind of information you want.

Although the cb_add_col_attributes() function will allow you to add any attributes you want, there are currently only four special attributes that the codebook() function (via cb_get_col_attributes()) will recognize and add to the column attributes table of the codebook document. They are:

Value

A tibble of column attributes


[Package codebookr version 0.1.8 Index]