problems with Hmisc-labelled objects in ggplot

前端 未结 1 972
南方客
南方客 2021-01-24 02:30

I get the message

Error:no applicable method for \'round_any\' applied to an object of class \"labelled\"

when I try to plot my gr

相关标签:
1条回答
  • 2021-01-24 03:01

    Remove the labels for plotting:

    library(Hmisc)
    
    DF <- data.frame(x=factor(rep(1:2,5)),y=1:10)
    
    label(DF$x)="xLab"
    label(DF$y)="yLab"
    
    library(ggplot2)
    
    ggplot(DF,aes(x=x,y=y)) + geom_boxplot()
    #Don't know how to automatically pick scale for object of type labelled. Defaulting to continuous
    
    ggplot(DF,aes(x=factor(unclass(x)),y=unclass(y))) + geom_boxplot()
    #no warning
    

    Unfortunately you don't give the details necessary to reproduce your error and give a customized solution.

    0 讨论(0)
提交回复
热议问题