data_clean: Basic cleaning of data

Description Usage Arguments Details Value See Also Examples

Description

Clean variable names and parse date

Usage

1
data_clean(data.xls)

Arguments

data.xls

data frame output from xls_read

Details

This function parse dates, nomalize 'variable names' appending the hour after each one. Date column is added in last column. Files were processed in Excel and SO Windows. There is a note about the origin in dates from Windows Excel. Date given as number of days since 1900-01-01, e.g. as.Date(32768, origin = "1900-01-01") is a date in 1989. Excel is said to use 1900-01-01 as day 1 (Windows default) but this is complicated by Excel incorrectly treating 1900 as a leap year. We use as origin '1899-12-30' to correctly parse dates. Please see http://support.microsoft.com/kb/214330 for details.

Value

data frame with the same values as the input data, but colnames are normalized and dates are parsed. All variables are character vectors.

See Also

Other data processing: data_tidy, varnames_recode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
if(interactive()){
xfiles_l <- list.files("vignettes/dvd_xls_files", recursive = TRUE, full.names = TRUE)
xls_file <- xfiles_l[1]
raw_data <- xls_read(xls_file)
clean_data <- data_clean(raw_data)
str(clean_data)
 }

## End(Not run)

lhmet/rinmetxls documentation built on May 28, 2019, 11:33 a.m.