Hmisc (version 3.0-12)

csv.get: Read Comma-Separated Text Data Files

Description

Read comma-separated text data files, allowing optional translation to lower case for variable names after making them valid S names.

Usage

csv.get(file, lowernames=FALSE, datevars=NULL, dateformat='%F',
        fixdates=c('none','year'), comment.char="", autodates=TRUE,
        allow=NULL, ...)

Arguments

file
the file name for import.
lowernames
set this to TRUE to change variable names to lower case.
datevars
character vector of names (after lowernames is applied) of variables to consider as a factor or character vector containing dates in a format matching dateformat. The default is "%F" which uses the yyyy-
dateformat
for cleanup.import is the input format (see strptime)
fixdates
for any of the variables listed in datevars that have a dateformat that cleanup.import understands, specifying fixdates allows corrections of certain formatting inconsistencies before the fie
comment.char
a character vector of length one containing a single character or an empty string. Use '""' to turn off the interpretation of comments altogether.
autodates
Set to true to allow function to guess at which variables are dates
allow
a vector of characters allowed by Rthat should not be converted to periods in variable names. By default, underscores in variable names are converted to periods as with Rbefore version 1.9.
...
arguments to pass to read.csv.

Value

  • a new data frame.

Details

csv.get reads comma-separated text data files, allowing optional translation to lower case for variable names after making them valid S names. Original possibly non-legal names are taken to be variable labels. Character or factor variables containing dates can be converted to date variables. cleanup.import is invoked to finish the job.

See Also

sas.get, data.frame, cleanup.import, read.csv, strptime, POSIXct, Date

Examples

Run this code
dat <- read.table('myfile.csv')
dat <- cleanup.import(dat)

Run the code above in your browser using DataLab