Displaying 1 result from an estimated 1 matches for "tp4599219p4599271".
2012 Apr 30
2
Matrix transposition
Hi everyone.
I want to transpose a data frame. Lets say the following DF:
df = data.frame(matrix(ncol=4, nrow = 10))
df[,1] = c(rep(1,5),rep(2,5))
df[,2] = c(rep('a',4),rep('b',3),rep('c',3))
df[,3] = c(letters[5:14])
df[,4] = runif(10)
I would like to form a data frame with each line corresponding to colon X1
and create a variable with columns X2 and X3.
This would