管道%>%的奇怪ReporteRs问题

时间:2018-03-16 12:19:38

标签: r method-chaining magrittr reporters

我突然遇到一个奇怪的ReporteR问题,即使我上次代码工作正常以来我没有更新或安装任何新软件包。

它似乎与管道操作员有关。这是一个例子:

此代码返回此非常一般的错误,我确信它在几周前在同一个表对象上工作: Code not working

确实重新编写没有管道的代码: Code working

我也遇到了与其他命令相同的问题,例如addParagraph,addSlide等,但只有在通过管道运算符链接时才会出现。

这是会话信息。有没有人遇到过这个问题,可以提出解决方案吗?

enter image description here

请注意,我的分析工作发生在一个没有连接到互联网的安全避风港环境中,因此无法控制安装的软件版本(并仅提供屏幕截图)。

编辑:使用的代码:

    paired_outcomes2 <- data.frame(sample = as.factor("Service"), percentage = as.character("50%"), count = as.integer(30))

# works
MyFTable <- paired_outcomes2 
  # The table
MyFTable <- FlexTable(MyFTable, add.rownames = FALSE, header.columns = F,
             header.cell.props = cellProperties( background.color = "white" ),
             header.text.props = textProperties( color = "black",
                                                 font.size = 11, font.weight = "bold" ),
             body.text.props = textProperties( font.size = 10 , font.family="Calibri"))

# doesn't work
MyFTable <- paired_outcomes2 %>% 
  # The table
  FlexTable( add.rownames = FALSE, header.columns = F,
             header.cell.props = cellProperties( background.color = "white" ),
             header.text.props = textProperties( color = "black",
                                                 font.size = 11, font.weight = "bold" ),
             body.text.props = textProperties( font.size = 10 , font.family="Calibri"))

1 个答案:

答案 0 :(得分:0)

啊我找到了原因!由于某种原因,软件包'sets'会破坏使用管道的ReporteRs命令,因此将其分离(我通常不会使用它,但在这种情况下使用它)可以解决问题。

相关问题