Dear R_Help:
The following gives me a matrix with integer values.
z= matrix(rep(10:1, each= 10), ncol= 10, byrow=TRUE) str(z) int [1:10, 1:10]
10 9 8 7 6 5 4 3 2 1 ...
How do I specify that I want Float32 values instead.
Thanks,Chris
Dear List,
I am trying to populate a matrix using a for loop.This works.
four- matrix(nrow=4,ncol=5) for (j in 1:ncol(four)){+ for (i in
1:nrow(four)){+ four[i,j]-i-1}+ } print(four) [,1] [,2] [,3] [,4]
[,5][1,] 0 0 0 0 0[2,] 1 1 1 1 1[3,] 2 2
2
?
matrix(rep(3:0, each = 5), ncol = 5, byrow = TRUE)
[,1] [,2] [,3] [,4] [,5]
[1,] 3 3 3 3 3
[2,] 2 2 2 2 2
[3,] 1 1 1 1 1
[4,] 0 0 0 0 0
HTH,
Dennis
On Tue, May 10, 2011 at 11:10 AM, Chris English wrote:
Dear List,
I am trying to populate a matrix using a for loop.This works.
four
3 matches
Mail list logo