fields_prospect: Field Descriptions

Description Usage Arguments Details Value Examples

Description

Descriptions of fields (variables) in the Dipep dataset

Usage

1
fields_prospect(df = master$screening, fields = fields)

Arguments

df

The data frame who's variables need describing

fields

A data frame that contains the information from the database specification spreadsheet produced by Data Management. It should have a bare minimum of two columns the 'Identifier' column (normally column D) and the 'Label' column (usually column E) and these should be named variable and description respectively.

Details

Variable names are sometimes informative, sometimes cryptic. To avoid this each data frames variables are described using the database specification produced by Data Management.

Value

Data frame of two columns, variable listing the variables in the data frame and description which provides the description of the variable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## You will need to download the 'fields' form from the Data Management database
## specification, read it in and rename columns appropriately.
fields <- <- read.csv('fields.csv')
fields <- dplyr::select(fields, Identifier, Label)
names(fields) <- c('variable', 'description')
## Finally because I work with '.' rather than '_' between words convert...
fields$variable <- gsub('_', '.', fields$variable)
## Save a description of your variables to a data frame that is part of alist of
## data frames (since there are multiple data frames in a given project)
README.variables <- list()
README.variables$screening <- fields_prospect(df     = master$screening,
                                              fields = fields)

ns-ctru/ctru documentation built on May 23, 2019, 9:34 p.m.