Skip to contents

This function loads one or more .csv files containing the NDS-BR data.

Usage

nds_load_data(pattern, folder = NULL, sep = ";", vars = NULL)

Arguments

pattern

A character object with a common initial text among the files to be read.

folder

A character object of the path to the folder containing the files.

sep

A character object defining the separator in the .csv file. Default is ";".

vars

A character vector of variable names to load. If empty, all variables are loaded.

Value

A tibble of the NDS-BR dataset.

Details

nds_load_data default considers that data inside the .csv files are separated by ';', and decimals are expressed by comma (','). If sep is set to ",", decimals must be expressed by ".". The pattern argument is used to identify a common initial text among the files. If only one file is to be loaded, pattern can be the full name of the file. In the folder argument it is possible to insert a path of the folder in which the files are included. If this field is left empty, the function considers that the files are present in the working directory of the project (getwd()). In the vars parameter it is possible to insert a character vector with the desired variable names to load.

Examples

## Considering driver_A.csv, driver_B.csv and driver_C.csv:
path <- system.file("extdata", package = "ndsbr")
df <- nds_load_data("driver", path)
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.