John Mount notes that you should not assume that the View()
function in R will work:
R tip: get out of the habit of calling
View()
directly.
View()
only works correctly in interactive environments, not currently in RMarkdown contexts. It is better to call something else that safely dispatches toView()
, or to something else depending if you are in an interactive or non-interactive session.
Click through for a script which is safe to run whether you’re in R Studio or using knitr to build a document.