R/tidyverse: calculating standard deviation across rows

后端 未结 6 1102
情深已故
情深已故 2020-12-19 05:53

Say I have the following data:

colA <- c(\"SampA\", \"SampB\", \"SampC\")
colB <- c(21, 20, 30)
colC <- c(15, 14, 12)
colD <- c(10, 22, 18)
df &l         


        
6条回答
  •  别那么骄傲
    2020-12-19 06:23

    Package magrittr pipes %>% are not a good way to process by rows.
    Maybe the following is what you want.

    df %>% 
      select(-colA) %>%
      t() %>% as.data.frame() %>%
      summarise_all(sd)
    #        V1       V2       V3
    #1 5.507571 4.163332 9.165151
    

提交回复
热议问题