R

Template for Shiny

New Template to get you produce cool Shiny App instantly flexdashboard install.packages("flexdashboard") library(flexdashboard)

CSS and SASS in Shiny

CSS = Cascading Style Sheets Selector Declaration To add CSS to Shiny: Add styling to tags Add CSS to HTML header Add style sheets with the www directory (most ideal) SASS = Systematically Awesome Style Sheets (built on top of CSS)

reproducible example (reprex)

install once per computer install.packages("reprex") or part of `tidyverse install.packages("tidyverse") You can either call it in every session library(reprex) or put it in .Rprofile for each machine to run whenever you open R

Scaling Shiny

To solve the problem of scaling: From DevOps/IT: Add memory, CPU Rstudio Connect set up for multiple machines From R/Shiny engineer: use Javascript for less CPU usage extract computations: Shiny worker, Plumber use a database

New Pipe in R

You can read more in Michael Barrowman’s post But the basic idea is that using the new pipe |> from the magrittr library is much faster than your old pipe %>%

Randomized Study Design

We can leverage R to create randomized studies using shinysurveys with learnr library("shinysurveys") library("learnr") ou can also use formr to create survey with R.

fix for "cannot allocate vector of size"

More package author’s introduction, please access this link Instead of loading everything at once into your RAM, you divide your data into chunks. To quote author of the disk.frame package: “we go from”R can only deal with data that fits in RAM"

caching for faster Shiny app

To have faster performance with Shiny App, you can pass this command to yoru script. # %>% bindCache()

learnr to guide students

Teaching statistics or data science, we can use learnr package. # library("learnr") To collect data, we can use learnrhash # library("learnrhash") Remember to adjust parameters so your Shinyapp.io can handle the number of students you have in the class.

use dplyr in Python - siuba library

Use siuba library in Python to preserve all your skills from dplyr package in R pip install siuba You can see TidyTuesday for tutorial Or Learn Siuba