R上的Crosstable软件包:如何仅显示百分比?
我如何仅在R上显示crosstable()
函数的百分比?我不希望这些数字在下面的示例中显示。
这是我的代码的一个示例:
control <- crosstable(ce_merged, c(msgctrl1_emotion, msgctrl2_emotion, msgctrl3_emotion, msgctrl4_emotion, msgctrl5_emotion), by=condition, percent_digits=0) %>%
as_flextable(keep_id=FALSE)
control
输出的示例:
How do I only show percentages with the crosstable()
function on R? I don't want the numbers to show on my example below.
Here's an example of my code:
control <- crosstable(ce_merged, c(msgctrl1_emotion, msgctrl2_emotion, msgctrl3_emotion, msgctrl4_emotion, msgctrl5_emotion), by=condition, percent_digits=0) %>%
as_flextable(keep_id=FALSE)
control
Example of output:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有可重现的示例,就很难回答,但是这里的关键是使用
percent_pattern
,只有您感兴趣的百分比(如果需要的话,以及一些装饰文本)。您可以在文档中看到有关此信息的更多信息: httpps:https:// danchaltiel。 github.io/crosstable/reference/crosstable.html#percent-pattern
It is difficult to answer without a reproducible example, but the key here is to use
percent_pattern
with only the percentage you are interested in (and some decoration text if needed).You can see more about this in the documentation: https://danchaltiel.github.io/crosstable/reference/crosstable.html#percent-pattern