I am working with a rarefaction output from mothur, which basically gives me a dataset containing the number of sequences sampled and the number of unique sequences in several samples. I would like to use ggplot2 to visualize this data and therefore need to use melt
to go from a wide
to a long
format.
The problem is that I find no way to make this work due to an error of melt
. Which basically states
Error: id variables not found in data: 1,3,6, (... and so on)
Because of the size of the original dataset it would be impractcal to share it here nonetheless one should be able to recreate the same problem using the following code:
a<-seq(0,300,3)
b<-runif(length(a))
c<-runif(length(a))
d<-as.data.frame(cbind(a,b,c))
d$a<-as.factor(d$a)
melt(d,d$a)
Which gives exactly the same error:
Error: id variables not found in data: 0,3,6,9, (...)
I fail to see what I am doing wrong. I am using R 2.15.1 on ubuntu server 12.04. Both the function reshape::melt
and reshape2::melt
result in the same error.