I have a data frame with columns initially labeled arbitrarily. Later on, I want to change these levels to numerical values. The following script illustrates the problem.
I think you can do this simply by transforming the variable to numeric:
mdf$variable <- as.numeric(as.character(mdf$variable))
g <- ggplot(mdf,aes(variable,value,group=variable,colour=t))
g +
geom_point() +
#scale_x_continuous() +
opts()
You need to convert your factor into numeric:
mdf$numVariable <- as.numeric(as.character(mdf$variable))
g <- ggplot(mdf,aes(numVariable,value,group=variable,colour=t))
g +
geom_point() +
#scale_x_continuous() +
opts()
Or just do the conversion in the call to ggplot:
g <- ggplot(mdf,aes(as.numeric(as.character(variable)),value,group=variable,colour=t))