And I'd like to add, just for the purpose of learning about R ... even if
wishes to use the loop version, there appears to be a misunderstanding of
R syntax.
The expression
1:225*100
does not produce 22500 numbers to put into the matrix, as apparently
expected.
Compare:
1:3*5
[1] 5 10
I found a solution myself, but thanks for the answers. I solved it like this:
D - matrix(1:225*100,nrow=100,ncol=225)
for(i in 1:225)
D[,i] - rt(100,df=225)
end
--
View this message in context:
http://r.789695.n4.nabble.com/Storing-datasets-tp4632874p4633071.html
Sent from the R help
On Tue, Jun 12, 2012 at 12:24 AM, Rody rodric_seu...@hotmail.com wrote:
I found a solution myself, but thanks for the answers. I solved it like this:
D - matrix(1:225*100,nrow=100,ncol=225)
for(i in 1:225)
D[,i] - rt(100,df=225)
end
but as Don said, you can do this in one step (and it is
This does tend to look like homework, but...
If you want them in one vector, then that vector will have length 225*100,
of course. So rt(225*100,225) would do it. Or you could use the matrix()
function to convert this to a matrix. See ?matrix.
-Don
--
Don MacQueen
Lawrence Livermore National
Hi everyone
I need to make a work for school in R and one of my questions is to create
225 datasets of 100 observations and they need to be t_225 distributed. So,
I know how to make one dataset (rt(100,df=225)), but how can I store those
225 in one vector, array,.. ?
--
View this message in
Take a look at ?replicate.
Michael
On Jun 9, 2012, at 5:16 AM, Rody rodric_seu...@hotmail.com wrote:
Hi everyone
I need to make a work for school in R and one of my questions is to create
225 datasets of 100 observations and they need to be t_225 distributed. So,
I know how to make one
6 matches
Mail list logo