read_data: Read common data formats

Description Usage Arguments Value Author(s) Examples

Description

A simple wrapper for reading data which currently supports Rdata, sav, txt, csv, csv2 and xlsx. Under the hood, it uses readxl, readr and haven.

Usage

1
read_data(file, ..., encoding = "UTF-8", decimal = ".")

Arguments

file

Path to a Rdata, sav (SPSS), txt, csv, csv2 or xlsx file.

...

Additional arguments passed to readxl and readr. For instance you can use sheet to specify a xlsx sheet when reading.

encoding

The encoding to use for txt and csv-files.

decimal

The decimal marker in the file. Typically "," in scandinavia, and "." in the U.S.

Value

A data.frame. If more than one sheet is read from a xlsx file (or you are reading a Rdata file) a list is returned instead.

Author(s)

Kristian D. Olsen

Examples

1
x <- read_data("test.xlsx")

itsdalmo/reporttool documentation built on May 18, 2019, 7:11 a.m.