purrr 中的图形

使用 purrr 掌握函数式编程基础

Auriel Fournier

Instructor

ggplot() 复习

  • ggplot() 需要数据框输入
  • 始终以 ggplot() 开始
  • 用 + 添加图层
  • geom_*() 指定图形类型
ggplot(data = dataframe, 
       aes(x = columnA,
       y = columnB))+
  geom_point()

鸟类体重与翼长的散点图

使用 purrr 掌握函数式编程基础

绘图与 purrr

birddf <- bird_measurements %>% 
 map_df(~ data_frame(
            wing_length = .x[["wing length"]],
            weight = .x[["weight"]])) %>%
    ggplot(aes(x = weight,
            y = wing_length))+
    geom_point()

鸟类体重与翼长的散点图

使用 purrr 掌握函数式编程基础

让我们练习吧!

使用 purrr 掌握函数式编程基础

Preparing Video For Download...