[R] RNORM matrix based on CSV file values for MEAN and SD

dcoakley danielcoakley1 at gmail.com
Tue May 22 18:40:04 CEST 2012


Thanks Michael,

This seems to get me half-way towards a solution. However, I am still having
some difficulty in getting the out.csv exactly as I would like. I should
probably explain the issue a bit further.

I am reading in a csv file containing a list of 'n' parameters. I have
attached a csv ( http://r.789695.n4.nabble.com/file/n4630928/read.csv
read.csv ) which contains 10 parameters as an example. However, the final
problem may have up to 2000 parameters. Currently, these have string titles
in the first column. However, I can change these to numbers if it causes
problems in R.

As you said correctly, this will give me a data.frame with mean and sd
values.

The problem I have is in the creation of the matrix of rnorm values. Using
the for loop specified, I am getting a single column with the rnorm values
for the last parameter specified (see attached 
http://r.789695.n4.nabble.com/file/n4630928/out.csv out.csv ). Re-running
the for loop appends another column to the csv file, below the original
column.

I have attached an example of the output I am looking for (
http://r.789695.n4.nabble.com/file/n4630928/OutputSample.csv
OutputSample.csv ). I believe, the approach here is correct, I just need to
make a few modifications to the for loop. This also needs to be scalable to
allow for the inclusion of multiple paramters (up to 2000) and samples (up
to 1 million). I will look into the dataConnections process you mentioned to
address this task.

Also, just in case the above attachments don't work, here is a link to the
shared files on Google Drive:
https://docs.google.com/open?id=0Bwwrh1DeZXteSFBXNVI1NGZfQjg

Thanks again for the help. Very much appreciated.

--
View this message in context: http://r.789695.n4.nabble.com/RNORM-matrix-based-on-CSV-file-values-for-MEAN-and-SD-tp4630901p4630928.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list