Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 2.55 KB

README.md

File metadata and controls

66 lines (46 loc) · 2.55 KB

Introduction to {box}

Files for Thursday, March 10, 2022 R Ladies - Twin Cities

View Slides

R and Package Information

R version 4.1.1 (2021-08-10) -- "Kick Things"

Package Version Information
{box} 1.1.0 Create box modules
{cowplot} 1.1.1 Layout multiple plots, using plot_grid()
base R1
{stats} 4.1.1 Create quantile breaks with quantile()
{datasets} 4.1.1 state.abb- list of 50 state abbreviations
Core tidyverse2
{tidyverse} {dplyr} 1.0.7 Data manipulation
{tidyverse} {ggplot2} 3.3.5 Create plots and charts
{tidyverse} {stringr} 1.4.0 Manipulate character strings
{tidyverse} {tidyr} 1.1.3 Create tibbles
tidyverse
{tidyverse} {glue} 1.5.1 Combine text and R code to crate string of text

{glue} is a another way to combine text then with paste()/paste0()

name <- "Martha" 

#with paste0() 
paste_out <- paste0("Hello ", name)
paste_out
#> [1] "Hello Martha"
class(paste_out)
#> [1] "character"

#with {glue}, anything in curly brakes is evaluated as R code 
glue_out <- glue::glue("Hello {name}")
glue_out
#> Hello Martha
class(glue_out)
#> [1] "glue"      "character"

EX_LONG

  • create two types of plots for multiple variables
  • 3 examples without using box in nobox-my.Rmd file
  • 1 example using box modules in my.Rmd file
  • box modules in myboxes folder

EX_SHORT

  • one output function to create a greeting when name is given
  • box module is in box folder
  • use box module in the my.R file

Footnotes

  1. Packages are automatically loaded in each R session so you don't need to install or import; however within box modules these packages need to be imported with box::use().

  2. All tidyverse packages can be installed using installed using install.packages("tidyverse") but core tidyverse packages can also be imported together using library("tidyverse"). For box modules refer to each specific package in the box::use() statement instead.