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...