dt <- data.frame(means = runif(5),
sds = runif(5),
medians = runif(5),
MissedPercentage = sample(c(0.1,0.3),5,replace = T) )
i wish to gather all the means
,sds
,and medians
, but the MissedPercentage
. So, here is what i did:
dt<-gather(dt,key=stat,value=c(`means`,`sds`,`medians`))
but it complains with:
Error: Must supply a symbol or a string as argument
My favorit answer is:
stat c("means", "sds", "medians") MissedPercentage
1 means 0.12638209 0.1
2 means 0.80834248 0.1
3 means 0.94386651 0.3
4 means 0.87709217 0.3
5 means 0.30200943 0.3
6 sds 0.06297956 0.1