Skip to contents

Set options for utils::read.csv(), openxlsx::read.xlsx() or readxl::read_excel. Choose delimiter and decimal separator as well as sheetnumbner and number of rows to read.

Usage

dataOptions(
  nrows = NA_integer_,
  colNames = TRUE,
  sep = ",",
  dec = ".",
  fileEncoding = "",
  sheet = 1
)

Arguments

nrows

integer: the maximum number of rows to read in. Negative and other invalid values are ignored.

colNames

If TRUE, the first row of data will be used as column names.

sep

the field separator character. Values on each line of the file are separated by this character. If sep = "" (the default for read.table) the separator is ‘white space’, that is one or more spaces, tabs, newlines or carriage returns.

dec

the character used in the file for decimal points.

fileEncoding

character string: if non-empty declares the encoding used on a file (not a connection) so the character data can be re-encoded. See the ‘Encoding’ section of the help for file, the ‘R Data Import/Export’ manual and ‘Note’.

sheet

The name or index of the sheet to read data from.

Value

a list of extra options for utils::read.csv() or openxlsx::read.xlsx() or readxl::read_excel, respectively