restrellado / dataedu

An R package associated with the Data Science in Education Using R book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dataedu

Travis build status

The goal of dataedu is to provide readers of Data Science in Education Using R with a package with useful functions, data, and references from the book.

Installation

1. Install {devtools}

First, let’s install devtools, an R package with many handy R tools. In your R console, type in:

install.packages("devtools", dependencies = TRUE)

If you already have {devtools} installed, you can move on to the next step.

If you are not sure whether you have it installed, you can run this function, which will install {devtools} if you do not already have it.

if (!require(devtools)) {
  install.packages("devtools")
  library(devtools)
}

2. Install {dataedu}

You can install the development version of {dataedu} by running this in your R Studio console:

devtools::install_github("data-edu/dataedu")

3. Call the package

Before you can use the package, make sure to call it using library():

library(dataedu)

Package Contents

We created this package to provide our readers an opportunity to jump into R however they see fit.

  1. Mass installation of all the packages used in the book
  2. Reproducible code for the walkthroughs
  3. The dataedu theme and color palette for reuse

Mass Installation of Packages

We strived to use packages that we use in our daily work when creating the walkthroughs in the book. Because we covered a variety of subjects, that means we used a lot of packages! As described in the Foundational Skills chapter, you can install the packages individually as they suit your needs.

However, if you want to quickly get started and download all the packages at once, please use mass_install(). This function uses the very handy p_install() from the pacman package, which facilitates the installation and loading of packages.

dataedu::mass_install()

To see the packages used in the book, run:

dataedu::all_packages
#>  [1] "apaTables"   "dummies"     "ggraph"      "here"        "janitor"    
#>  [6] "lme4"        "lubridate"   "performance" "readxl"      "rtweet"     
#> [11] "randomNames" "sjPlot"      "tidygraph"   "tidyverse"   "tidytext"

A special note on {tabulizer}: One of the walkthroughs uses tabulizer, created by ROpenSci to read PDFs. {tabulizer} requires the installation of RJava, which can be a tricky process on Mac computers. {tabulizer} is not included in mass_install() and we recommend reading through the notes on its Github repo if installing.

Reproducible Code for Walkthroughs

Using the {dataedu} Theme and Palette

As in following, simply add the theme and palette to ggplot2-based plots:

library(ggplot2)
library(dataedu)

ggplot(midwest, aes(x = area, y = popdensity, color = state)) +
  geom_point() +
  theme_dataedu() +
  scale_color_dataedu()

Contact

About

An R package associated with the Data Science in Education Using R book

License:Creative Commons Attribution 4.0 International


Languages

Language:R 100.0%