> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of chakri > Sent: Tuesday, August 02, 2011 6:31 AM > To: r-help@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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.