Thank you. It worked!
Quoting Henrique Dallazuanna :
Try this:
reshape(d, timevar = "x", idvar = "y", direction = "wide")
On Tue, Jan 6, 2009 at 6:29 AM, wrote:
Dear Sir or Madam,
I have the following data frame (which is just a toy example of my larger
dataset)
L3 <- LETTERS[1:3]
x=c(1
try this:
L3 <- LETTERS[1:3]
x=c(1,1,2,2,3,3,4,4,5,5)
y=1:10
d <- data.frame(cbind(x,y), fac=I(sample(L3, 10, replace=TRUE)))
m.out <- matrix(ncol=10, nrow=10)
m.out[cbind(d$x, d$y)] <- d$fac
On Tue, Jan 6, 2009 at 3:29 AM, wrote:
> Dear Sir or Madam,
>
> I have the following data frame (which
Try this:
reshape(d, timevar = "x", idvar = "y", direction = "wide")
On Tue, Jan 6, 2009 at 6:29 AM, wrote:
> Dear Sir or Madam,
>
> I have the following data frame (which is just a toy example of my larger
> dataset)
>
> L3 <- LETTERS[1:3]
> x=c(1,1,2,2,3,3,4,4,5,5)
> y=1:10
> d <- data.frame(
3 matches
Mail list logo