I have looked to all similar question of stackoverflow but without success.
Consider the iris data set. I just want to put the species as columns, and get below each species names, only the Sepal Length.
So far I get:
library("reshape2")
data(iris)
iris$ID <- 1:nrow(iris)
acast(iris,ID~Species,value.var="Sepal.Length")
The result is almost what I expected... Excepted all the NA that shouldn't be here (each column values should be shifted up to that we get only 50 rows for the whole data frame).