Standard Deviation of a matrix
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of chakri
Sent: Tuesday, August 02, 2011 6:31 AM
To: r-help at r-project.org
Subject: Re: [R] Standard Deviation of a matrix
Thank you everyone for your kind input,
I forgot to add that I have decimal points in my matrix !
Enclosed input file (reduced to 10 X 10 matrix), scripts and output for
your
suggesions:
Code 1:
library(stats)
Matrix<-read.table("test_input", head=T, sep=" ", dec=".")
SD<-sd(as.numeric(Matrix))
SD
First, your data attachment did not come through the list. Second, decimals are not a problem. Third, you don't have a matrix, you have a data frame (read.table produces data frames). As long as all columns are numeric you could do something like sd(c(as.matrix(m))) You could also convert to a matrix on input if you really don't need a dataframe for different column types. Hope this is helpful, Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204