How do I get discrete factor levels to be treated as continuous?

前端 未结 2 1974
鱼传尺愫
鱼传尺愫 2020-12-10 05:15

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.

2条回答
  •  北海茫月
    2020-12-10 05:53

    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()
    

提交回复
热议问题