I have run into something that is baffling me, and I feel like I must be missing something obvious.
When I print a character vector in an Rmarkdown notebook by simply putting the name of the vector (abc
) in a block, this renders as expected in RStudio. But when I render the notebook with rmarkdown::render()
it prints twice. Once as expected:
[1] "a" "b" "c"
and once with lots of extra space:
a
b
c
Using print(abc)
solves the trouble and prints the same either way, but I would rather not have to do that...
Also, rendering with output_format = "html_document"
renders as expected. It is only with the html_notebook
output that I see this.
This does not affect numeric vectors.
A gist with a test notebook is here: https://gist.github.com/jashapiro/20ad401c9834638e4dee699e44ab7167
Is there an argument I should be adding to rmarkdown::render()
to make it behave as RStudio does?
I have tried --vanilla
and xfun::Rscript_call()
, but get the same results.
I have tested this with rmarkdown
2.6 & 2.7 R
4.03 & 4.04. I feel like perhaps I didn't have this problem with earlier versions, but I can't say for certain.