Learn R Programming

marginaleffects (version 0.25.1)

get_dataset: Download and Read Datasets from marginaleffects or Rdatasets

Description

Downloads a dataset from the marginaleffects or the Rdatasets archives, and return it as a data frame. Opens the documentation as an HTML page. Search available datasets.

https://vincentarelbundock.github.io/Rdatasets/

Usage

get_dataset(
  dataset = "thornton",
  package = "marginaleffects",
  docs = FALSE,
  search = NULL
)

Value

A data frame containing the dataset. library(marginaleffects)

Arguments

dataset

String. Name of the dataset to download.

  • marginaleffects archive: affairs, airbnb, ces_demographics, ces_survey, immigration, lottery, military, thornton, factorial_01, interaction_01, interaction_02, interaction_03, interaction_04, polynomial_01, polynomial_02

  • Rdatasets archive: The name of a dataset listed on the Rdatasets index. See the website or the search argument.

package

String. Package name that originally published the data.

docs

Logical. If TRUE open the documentation using getOption("viewer") or the Rstudio viewer.

search

Regular expression. Download the dataset index from Rdatasets; search the "Package", "Item", and "Title" columns; and return the matching rows.

Examples

Run this code
dat <- get_dataset("Titanic", "Stat2Data")
head(dat)

get_dataset(search = "(?i)titanic")

# View documentation in the browser
# get_dataset("Titanic", "Stat2Data", docs = TRUE)

Run the code above in your browser using DataLab