Tip 1: install this handy package that shows you each step of your pipe chain sequence


- devtools::install_github(“daranzolin/ViewPipeSteps”)
- highlight your text and click “Addins” and select View Pipe Chain Steps

library(tidyverse)
library(ViewPipeSteps)

mydat <- diamonds %>%
  as_tibble() %>%
  select(carat, cut, price) %>%
  filter(cut == "Ideal" | cut == "Premium") %>%
  arrange(desc(price))

mydat
## # A tibble: 35,342 x 3
##    carat cut     price
##    <dbl> <ord>   <int>
##  1  2.29 Premium 18823
##  2  1.51 Ideal   18806
##  3  2.07 Ideal   18804
##  4  2.29 Premium 18797
##  5  2.04 Premium 18795
##  6  2    Premium 18795
##  7  1.71 Premium 18791
##  8  2.15 Ideal   18791
##  9  2.05 Ideal   18787
## 10  2.05 Premium 18784
## # … with 35,332 more rows

Tip 2: Command+I to clean up misaligned/messy code

mydat_messy <- diamonds %>%
    as_tibble() %>%
          select(carat, cut, price) %>%
      filter(cut == "Ideal" | cut == "Premium") %>%
  arrange(desc(price))
 
mydat_clean <- diamonds %>%
  as_tibble() %>%
  select(carat, cut, price) %>%
  filter(cut == "Ideal" | cut == "Premium") %>%
  arrange(desc(price))

Tip 3: you can hover over a variable that’s already been defined and hold down Command (on mac) and click the variable to get a closer look - same function as View()


Tip 4: you can use the mouse wheel to scroll through open tabs within R studio


Tip 5: you can select text/code within a chunk and click insert R (or Alt+Command+I) and it will move it to it’s own new chunk


Tip 6: Command + up in console to navigate history