I went back to some R code that I wrote last month, but it appears that the version of reshape (0.8.4, R 2.15.2) I am using has changed that functionality.
Here is a sample:
> library(reshape)
> so.test <- data.frame(
one = as.character(rnorm(750)),
two = as.character(rnorm(750)),
three = as.character(rnorm(750)), four = as.character(rnorm(750)))
> check <- melt(so.test)
Using one, two, three, four as id variables
This gives a data.frame equal to the original:
> table(so.test == check)
TRUE
3000
I have also tried this with reshape2::melt but I am getting the same result. Interestingly, the melt() function works as expected with a data.frame with numeric values:
> so.test2 <- data.frame(
one = rnorm(750),
two = rnorm(750),
three = rnorm(750), four = rnorm(750))
> check2 <- melt(so.test2)
Using as id variables
> head(check2)
variable value
1 one 0.2471168
2 one -0.0663480
3 one -0.0251867
4 one 2.8786207
5 one -0.2586785
6 one -0.7508927
The documentation for both the reshape and the reshape2 version say:
So
meltis behaving as documented.