Learn R Programming

MLmorph (version 0.1.1)

load_data: Load tabular data (xlsx, csv, or json)

Description

Load tabular data (xlsx, csv, or json)

Usage

load_data(data_path)

Value

A base data.frame with the imported data.

Arguments

data_path

Character scalar; path to a .xlsx, .csv, or .json file.

Examples

Run this code
tmp_csv <- tempfile(fileext = ".csv")
utils::write.csv(data.frame(a = 1:2, b = c("x", "y")), tmp_csv, row.names = FALSE)
load_data(tmp_csv)

tmp_json <- tempfile(fileext = ".json")
jsonlite::write_json(list(a = 1:2, b = c("x","y")), tmp_json, auto_unbox = TRUE)
load_data(tmp_json)

tmp_xlsx <- tempfile(fileext = ".xlsx")
openxlsx::write.xlsx(data.frame(a = 1:2, b = c("x","y")), tmp_xlsx)
load_data(tmp_xlsx)

Run the code above in your browser using DataLab