readFromCsv: Read data into a variable from a csv file

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/readFromCsv.r

Description

In Excel, save data to a csv file. Uuse this function to read that data into an R variable.

Usage

1
2
3
4
5
readFromCsv(file, 
  stringsAsFactors = default.stringsAsFactors(),
  simplify = TRUE, drop = TRUE, 
  na.strings = c("", "NA", "#DIV/0!"), zero.strings = "-",  
  convertFormattedNumbers = TRUE, ..., header = TRUE, rowheader = FALSE)

Arguments

file

file to read from; if not specified (missing) you will be asked to browse to the file to "Open"

stringsAsFactors

keep default

simplify

should matrices with length 1 in one of the dimensions be converted to vectors (TRUE)?

drop

keep default

na.strings

strings that you want considered to be NA

zero.strings

strings that you want considered to be zero

convertFormattedNumbers

do you want to eliminate dollar signs, commas, etc. in formatted numbers (TRUE) or read those cells as character values (FALSE)?

...

other stuff

header

did you copy the column header(s) too?

rowheader

did you copy the row header(s)/name(s) too?

Details

Essentially a wrapper for R's read.csv function that standardizes the argument list throughout the excelRio package.

Value

An R object, either a data.frame, a matrix or a vector.

Author(s)

dmm

See Also

writeToCsv, readFromExcel, pasteFromExcel, copyToExcel

Examples

1
2
3
4
5
6
# In Excel, save a sheet of data to a csv file, e.g., Book1.csv. 
# Suppose the data was a table of data by accident year,
# with the accident years being in column A, thereby "naming" the rows of data.
# Back in R ...
### NOT RUN
# x <- readFromCsv("Book1.csv", rowheader = TRUE)

trinostics/excelRio documentation built on June 18, 2020, 4:41 p.m.