0

I want to calculate the mean and the sd from a matrix (14*20) that I import like this from a csv file:

data<- read.csv("data.csv",header=F,sep=";")

Why does this not work: sd(data) and mean(data)

Nick Kennedy
  • 12,510
  • 2
  • 30
  • 52
  • http://stackoverflow.com/questions/9424311/how-to-get-mean-median-and-other-statistics-over-entire-matrix-array-or-dataf see if this answers your question. – goodtimeslim Jun 21 '15 at 20:30
  • `read.csv` returns a data.frame, not a matrix. If you want the mean of all 280 numbers, you could do `mat <- data.matrix(data); mean(mat); sd(mat)`. If you intend to do column-wise means and sds then see the linked question by @goodtimeslim. – Nick Kennedy Jun 21 '15 at 20:34

0 Answers0