I have a dataset with 5 columns rachis1 to rachis5 being numeric. I have 100 rows of data with names attached to each row as a factor. I want to do a summary for each row for all five columns.
head(rl)
name rachis1 rachis2 rachis3 rachis4 rachis5
1 R04-001 2.4 2.6 2.7 3.0 2.4
2 R04-002 7.0 7.4 7.7 6.8 7.4
3 R04-003 3.5 3.7 3.9 4.1 3.8
4 R04-004 9.5 9.1 7.8 8.8 8.2
5 R04-005 3.0 3.3 3.4 3.8 3.3
6 R04-006 9.2 9.8 9.5 9.4 10.1
My code for this is.
library(dplyr)
####Rachis
RL<- rl %>%
group_by(name) %>%
summarize(RL= mean(rachis1:rachis5), RLMAX = max(rachis1:rachis5),RLMIN =
min(rachis1:rachis5), RLSTD=sd(rachis1:rachis5),na.rm=T)
head(RL)
tail(RL)
My resulting analysis comes out as...
head(RL)
# A tibble: 6 x 6
name RL RLMAX RLMIN RLSTD na.rm
<fctr> <dbl> <dbl> <dbl> <dbl> <lgl>
1 R04-001 2.4 2.4 2.4 NA TRUE
2 R04-002 7.0 7.0 7.0 NA TRUE
3 R04-003 3.5 3.5 3.5 NA TRUE
4 R04-004 9.0 9.5 8.5 0.7071068 TRUE
5 R04-005 3.0 3.0 3.0 NA TRUE
6 R04-006 9.2 9.2 9.2 NA TRUE
I was wondering why there is NA in the RLSTD(standard deviations) and the min and max are not the mix and max of the row. Is there another way to gather my descriptive statistics?