[R] function 사용하여 반복작업 쉽게 하기
반복작업할때 function 기능 사용하면 코드를 간결화 할 수 있음. 기본 function(x, y) { any_command(x, y) } select_col 기능을 생성 select(), mutate(), filter() 세가지 명령을 한번에 함. #10 -5th.1 col2 = c("id","psu","kstrata","wt_itvex","age","sex", "he_crea", "he_uph", "he_unitr", "he_usg", "he_upro", "he_uglu", "he_uket", "he_ubil", "he_ubld", "he_uro") select_col % select(col2) %>% mutate(wt=wt_itvex*1/9.5) %>% select(-wt_itvex) %>% f..
2020. 12. 17.