[R] Autofilling a large matrix in R
wwreith
reith_william at bah.com
Fri Oct 12 16:30:14 CEST 2012
I wish to create a matrix of all possible percentages with two decimal place
percision. I then want each row to sum to 100%. I started with the code
below with the intent to then subset the data based on the row sum. This
works great for 2 or 3 columns, but if I try 4 or more columns the number of
rows become to large. I would like to find a way to break it down into some
kind of for loop, so that I can remove the rows that don't sum to 100%
inside the for loop rather than outside it. My first thought was to take
list from 1:10, 11:20, etc. but that does not get all of the points.
g<-as.matrix(expand.grid(rep(list(1:100), times=3)))
Any thoughts how to split this into pieces?
--
View this message in context: http://r.789695.n4.nabble.com/Autofilling-a-large-matrix-in-R-tp4645991.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list