0
votes

I am having an odd issue with ReporteRs all of a sudden, even though I haven't updated or installed any new packages since the last time my code worked fine.

It seems to be related to the pipe operator. Here is an example:

This code returns this very general error, and I am sure it worked on the same table object a couple of weeks ago: Code not working

Indeed re-writing the code without pipes works: Code working

I get the same issue with other commands too, such as addParagraph, addSlide, etc, but only when chained through the pipe operator.

Here is the session info. Has anybody come across this issue, and can suggest a solution?

enter image description here

Note my analysis work takes place in a safe haven environment that is not connected to the internet, hence not being able to have much control over what software versions are installed (and providing screenshot only).

EDIT: Code used:

    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
Hey I wish you would have provided some data... However, it looks like in your first command you are assigning data within paired_outcomes2 object to the MyFTable object and then making your FlexTable(). In the command the MyFTable is already in the FlexTable Command and then you re name it. Either you got your pipe going the wrong way or something changed with how you created your paired_outcomes2 object and the MyFTable object worked because you had saved it previously and then reloaded it to your R environment. Show me how you made the paired_outcomes2 object. - THATguy
Thanks, added example code now - user3257121

1 Answers

0
votes

Ah I found the reason! The package 'sets' for some reason disrupts the ReporteRs commands that use pipes, so detaching it (I don't normally use it but had on this occasion) fixes the issue.