Displaying 3 results from an estimated 3 matches for "10x3".
Did you mean:
1093
2007 Oct 29
3
how to split data.frame by row?
hi,
if I have 20 x 3 data.frame, how to split it into
10 x 6 (moving the lower part of 10x3 to column)
or
5 x 12
thanks
--
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.
"Did you always know?"
"No, I did not. But I believed..."
---Matrix III
2023 Dec 08
1
Convert two-dimensional array into a three-dimensional array.
Colleagues
I want to convert a 10x2 array:
# create a 10x2 matrix.
datavals <- matrix(nrow=10,ncol=2)
datavals[,] <- rep(c(1,2),10)+c(rnorm(10),rnorm(10))
datavals
into a 10x3 array, ThreeDArray, dim(10,2,10).
The values storede in ThreeDArray's first dimensions will be the data stored in datavalues.
ThreeDArray[i,,] <- datavals[i,]
The values storede in ThreeDArray's second dimensions will be the data stored in datavalues.
ThreeDArray[,j,] <- datavals[...
2008 Nov 22
5
What's the BEST way in R to adapt this vector?
Goal:
Suppose you have a vector that is a discrete variable with values ranging
from 1 to 3, and length of 10. We'll use this as the example:
y <- c(1,2,3,1,2,3,1,2,3,1)
...and suppose you want your new vector (y.new) to be equal in length to the
possible discrete values (3) times the length (10), and formatted in such a
way that if y[1] == 1, then y.new[1:3] == c(1,0,0), and if y[2] ==