cleanDataFrame: Check and Clean data.frame for usage with variable key...

View source: R/variableKey.R

cleanDataFrameR Documentation

Check and Clean data.frame for usage with variable key functions

Description

Checks that the data.frame is made up of simple individual columns. Checks numeric columns to find out if they are acceptable to treat as integers. If they are acceptable to treat as integers, then convert those numeric to integer class variables.

Usage

cleanDataFrame(dframe, safeNumericToInteger = TRUE, trimws = "both")

Arguments

dframe

A data frame

safeNumericToInteger

Default TRUE: Should we treat values which appear to be integers as integers? If a column is numeric, it might be safe to treat it as an integer. In many csv data sets, the values coded c(1, 2, 3) are really integers, not floats c(1.0, 2.0, 3.0). See safeInteger.

trimws

Defaults as "both", in meaning of which argument in trimws function. Set as NULL if character variables must not be trimmed to eliminate white space. Otherwise, value should be one of c("left", "right", "both").

Value

A checked and cleaned data frame

Author(s)

Paul Johnson <pauljohn@ku.edu>


kutils documentation built on Sept. 17, 2023, 5:06 p.m.