Skip to contents

Downloads and loads a dataset from predefined course servers or a user-defined URL.

Usage

courseData(name, url = NULL, header = TRUE, sep = ";", ...)

Arguments

name

character string. File name including extension (e.g. "data.csv").

url

optional character string. Base URL where the file is located. If NULL, default course repositories are searched.

header

logical. Whether the file contains a header row. Passed to read.table().

sep

character. Field separator used in the file. Default is ";".

...

additional arguments passed to the underlying import functions such as read.table() or openDataObject().

Value

a data frame or object returned by the respective import function:

  • for text files: a data.frame.

  • for Excel files: an object returned by openDataObject().

Details

If no url is provided, the function searches for the file in the following locations (see https://github.com/AndriSignorell/Teaching):

  • https://raw.githubusercontent.com/AndriSignorell/Teaching/main/book/

  • https://raw.githubusercontent.com/AndriSignorell/Teaching/main/data/

The first location where the file exists is used.

File type handling:

See also

Other datasets: Cards, Pizza, Roulette, Tarot

Examples

if (FALSE) { # \dontrun{
# Load from default repositories
courseData("fullmoon.xlsx")

# Load from custom URL
courseData("mydata.csv", url = "https://example.com/data/")
} # }