purrr로 배우는 중급 함수형 프로그래밍
Colin Fay
Data Scientist & R Hacker at ThinkR
transpose()로 결과 변환:
# Transpose turn a list of n elements a and b
# to a list of a and b, with each n elements
l <- list("a", 2, 3)
map(l, safe_log) %>% length()
3
map(l, safe_log) %>% transpose() %>% length()
2
compact()는 NULL을 제거합니다:
list(1, NULL, 3, 4, NULL) %>%
compact()
[[1]]
[1] 1
[[2]]
[1] 3
[[3]]
[1] 4
otherwise = NULL %>% compact():
l <- list(1,2,3,"a")
possible_log <- possibly(log, otherwise = NULL)
map(l, possible_log) %>% compact()
[[1]]
[1] 0
[[2]]
[1] 0.6931472
[[3]]
[1] 1.098612
httr: R을 위한 친숙한 http 패키지
H. Wickham
httr 시작하기
H. Wickham
purrr로 배우는 중급 함수형 프로그래밍