r - mean function producing same result -


the mean function acting weird, producing 0.3880952

h10 <- h10 %>%    rowwise() %>%    mutate(t10dv = mean(c(fd$dv1_c, fd$dv2_c,                          fd$dv3_c, fd$dv4_c),           na.rm = true))  head(h10)              dv1_c           dv2_c         dv3_c           dv4_c     t10dv             <int>           <int>           <int>           <int>     <dbl> 1               1               0               0               1 0.3880952 2              -1               0               2              -1 0.3880952 3               0               0               0               0 0.3880952 4               0               2               1               1 0.3880952 5              -1              -1              -1              -2 0.3880952 6              -2               0               0               0 0.3880952 

what should simply:

h10$t10dv <- rowmeans(h10[c("dv1_c", "dv2_c", "dv3_c", "dv4_c")]) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -