G1G2Effect WEIGHT2 Sim1 Sim2 Sim3 Sim4 Sim5 Sim6 Sim7 Sim8 Sim9 Sim10 Sim11 Sim12
1 -0.0312 2.833103 -0.0312 -0.0312 0.0000 -0.0312 0.0312 0.0000 -0.0312 -0.0312 -0.0312 -0.0312 0.0000 -0.0312
2 -0.0640 2.536790 0.0000 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640 -0.0640
3 0.0420 3.309074 0.0420 0.0000 0.0000 0.0420 0.0420 0.0420 0.0420 0.0420 0.0420 0.0420 0.0420 0.0000
4 0.0332 2.476224 0.0332 0.0332 0.0332 0.0332 0.0332 0.0000 0.0332 0.0332 0.0332 0.0332 -0.0332 0.0332
5 0.0000 2.265289 0.0302 0.0302 0.0302 0.0000 0.0302 0.0000 0.0302 -0.0302 0.0302 0.0000 0.0302 0.0000
6 0.0000 1.272609 0.0116 0.0000 0.0000 0.0116 0.0000 -0.0116 0.0032 -0.0102 0.0101
I have the data.frame above^. I am trying to make a new data.frame that is just the sum of each column.
df2 <- colSums(as.numeric(as.character(df1)))
but I am getting the error message
Error in colSums(as.numeric(as.character(exam))) : 'x' must be an array of at least two dimensions In addition: Warning message: In is.data.frame(x) : NAs introduced by coercion
What is going on?
factor, uselapplyto do thislapply(df1, function(x) as.numeric(as.character(x)))- akrun