Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

バイオインフォ分野におけるtidyなデータ解析の最新動向

1,373 views

Published on

Mishima.syk#16
https://connpass.com/event/164605/

Published in: Science
  • Be the first to comment

バイオインフォ分野におけるtidyなデータ解析の最新動向

  1. 1. for tmp1 <- f(input) tmp2 <- g(tmp1) output <- h(tmp2) for(i in 1:I){ # 1 tmp1 }
 for(j in 1:J){ # 2 tmp2 } for(k in 1:K){ # 3 output } output <- h(g(f(input)))
  2. 2. apply sapply lapply apply apply tmp1 <- apply(input, 1, function(x){ # 1 }) tmp2 <- apply(tmp1, 1, function(x){ # 2 }) output <- apply(tmp2, 1, function(x){ # 3 })
  3. 3. output <- apply(input, 1, function(x){ # 1 apply(x, 1, function(y){ # 2 apply(y, 1, function(z){ # 3 }) }) }) tmp1 <- apply(input, 1, function(x, y){ # 1 }, y=input2)
  4. 4. input %>% f() %>% g() %>% h() -> output tidyverse data.frame tibble

  5. 5. input %>% ... %>% summary()
 input %>% ... %>% ggplot()
 input %>% ... %>% plot_ly()
 input %>% ... %>% save() input %>% ... -> tmp_object for apply filter mutate
  6. 6. tidyverse ggplot2
  7. 7. ❌ ❌ ✅ ✅
  8. 8. tidyr pivot_wider pivot_longer
  9. 9. ✅ ✅ ✅ ❌
  10. 10. ✅ ✅ ❌ ✅
  11. 11. tidyverse readr read_delim tidyr pivot_wider pivot_longer magrittr %>% dplyr select, filter, group_by ungroup, mutate ggplot2 purrr tidyverse apply map/map2
  12. 12. iris > iris
  13. 13. > iris %>% select(Petal.Width, Species) select
  14. 14. > iris %>% select(Petal.Width, Species) %>% filter(Species != "virginica") filter
  15. 15. > iris %>% select(Petal.Width, Species) %>% filter(Species != "virginica") %>% group_by(Species) group_by
  16. 16. > iris %>% select(Petal.Width, Species) %>% filter(Species != "virginica") %>% group_by(Species) %>% mutate(mean=mean(Petal.Width)) mutate
  17. 17. > iris %>% select(Petal.Width, Species) %>% filter(Species != "virginica") %>% group_by(Species) %>% mutate(mean=mean(Petal.Width)) ungroup %>% map(., unique) ungroup map
  18. 18. tibble tibble tibble tibble tibble tibble tibble tibble tibble
  19. 19. tibble tibble tibble tidybulk tibble tidybulk keep_abundant identify_abundant reduce_dimensions tibble
  20. 20. input %>% ... %>% %>% ...
  21. 21. fit <- lm(y ~ x, data) data %>% ... %>% lm(y ~ x, .)
  22. 22. list tidy ... lm(y ~ x, .) %>% ...
  23. 23. iris %>% group_by(Species) %>% nest() %>% mutate(model_lm = map(data, ~lm(Petal.Length ~ Sepal.Width, data = .))) -> res.lm
  24. 24. library(broom) iris %>% group_by(Species) %>% do(tidy(lm(Petal.Length ~ Sepal.Width, data = .))) -> res.lm
  25. 25. tidy()
  26. 26. %>%? %>% %>% %>% %>%?
  27. 27. recipes broom

×