\clearpage

ggplot2

The example is from: https://github.com/tidyverse/ggplot2.

library("ggplot2")

ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()

tibble

The examples are from: https://github.com/tidyverse/tibble.

library("tibble")
as_tibble(iris)

tibble(x = 1:5, y = 1, z = x ^ 2 + y)

tribble(
  ~x, ~y,  ~z,
  "a", 2,  3.6,
  "b", 1,  8.5)

purrr

The example is from: https://github.com/tidyverse/purrr.

library("purrr")

mtcars %>%
  split(.$cyl) %>% # from base R
  map(~ lm(mpg ~ wt, data = .)) %>%
  map(summary) %>%
  map_dbl("r.squared")

dplyr

The examples are from: https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html.

library("dplyr")
library("nycflights13")

filter(flights, month == 1, day == 1)

slice(flights, 1:10)

arrange(flights, year, month, day)

select(flights, year, month, day)

mutate(flights,
  gain = arr_delay - dep_delay,
  speed = distance / air_time * 60)

summarise(flights,
  delay = mean(dep_delay, na.rm = TRUE))

Session information

The R session information for compiling this document is shown below.

sessionInfo()


road2stat/liftr documentation built on March 14, 2024, 11:12 p.m.