knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Package {discrtr} is a companion to the book Discrete Choice Analysis with R. It includes templates with code and data sets used in the book.
Install the released version of usethis from CRAN:
install.packages("discrtr")
Or you can install the development version of discrtr from GitHub with:
# install.packages("remotes") remotes::install_github("paezha/discrtr")
One data set included in the package relates to commuting in a university setting. Analysis of this data was reported by Whalen, Páez, and Carrasco (2012). The wide version of the data table can be loaded as follows:
library(discrtr) data("mc_commute_wide")
This is a quick summary of the travel time variables in the table:
library(dplyr) mc_commute_wide %>% dplyr::select(starts_with("time.")) %>% summary()
There are four modes of transportation in this data set, but not all modes were available to every respondent, hence the NA's. A missing value for any of the time variables indicates that the mode was not part of the choice set for the corresponding traveller.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.