r - 如何将行名添加到弹性表?
问题描述
无法让 add.rownames = TRUE 在 flextable 中工作
> tabelM
Man Vrouw
Gaat wel 337 442
Goed 935 1150
Slecht 57 83
Zeer goed 262 243
Zeer slecht 14 10
> rownames(tabelM)
[1] "Gaat wel" "Goed" "Slecht" "Zeer goed" "Zeer slecht"
> colnames(tabelM)
[1] "Man" "Vrouw"
> flextable(tabelM)
#works fine
> flextable(tabelM,add.rownames = TRUE)
flextable 中的错误(tabelM,add.rownames = TRUE):未使用的参数(add.rownames = TRUE)
解决方案
您可以将此解决方法与软件包tibble
和dplyr
:
library(dplyr)
library(tibble)
flextable(tabelM %>% rownames_to_column("column name"))
正如评论中已经提到的,flextable
没有名为add.rownames的参数
推荐阅读
- xcode - Xcode 10 在为 C++ 插入包含名称时破坏了自动完成功能,有什么解决方法吗?
- c++ - 将 std::function 与模板一起使用
- html - iPhone 上的 HTML5 视频元素有边框
- php - 挑选嵌套 json 中的单个值
- c++ - C++ 未定义命名空间
- java - JNI,使用两个需要另一个的.so文件时出错
- swift - 线程 1:EXC_BAD_ACCESS(代码=2,地址=0x7ffee7cceff8)
- dialogflow-es - 对话流中每个意图的最大训练短语数是多少?
- c# - 我在循环中编写的内容以在 datagridview 上显示类似的项目代码并在数据库 sql 服务器上插入不同的项目代码
- swift - 转换 SWIFT 4.2 自动更新时出错