R ggplot Hmisc labell阅读 [英] R ggplot Hmisc labell reading

查看:197
本文介绍了R ggplot Hmisc labell阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到消息

I get the message


错误:没有应用于
class对象的'round_any'的适用方法

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

当我尝试使用ggplot2和R来绘制我的图时我使用Hmisc ::在我的数据框中标记了我的变量。标签,我认为这是问题。如何解决此问题?

when I try to plot my graphs using ggplot2 and R. I have labelled my variables in my data frame using with Hmisc::label and I think this is the problem. How do I solve this issue?

我的标签看起来像这样:

My labels look like this:

   label(data$results_lp)="Lumbure Puncture Results"
   label(data$hiv_test)="HIV Test done"
   label(data$outcome)="Outcome at Discharge"
   label(data$vac_10mnth_complete)="Vaccinne 10months complete"
   label(data$vac_3mnth_complete)="Vaccine 3months complete"
   label(data$vac_uptodate)="Vaccine up to date"
   label(data$dx1_pneum_rcd)="Pneumonia Recorded"
   label(data$mal)="Malaria"
   label(data$dx1_malaria)="Documented Malaria"
   label(data$dehydrat)="Dehydration"

我如何解决这个问题?

How do I solve this?

推荐答案

删除打印标签:

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.

这篇关于R ggplot Hmisc labell阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆