Unclear how pander::eval captures stdout.
When executing in the R REPL, I find a surprising (to me) result.
> pander::evals("print(1:4)")$stdout
NULL
I would expect this print statement to print to stdout and the results would be visible in the stdout field, but this is not the case.
- Is this the intended behavior?
- Is there a way to get the printed object?
For context, I'm trying to build a literate programming environment within the Typst typesetter.
Thanks to the maintainers for all your hard work, this seems like such a hard problem throughout all my research on it
evals tries to do so many things that I'm embarrassed now looking at it after so many years since implementing it :blush: I would need some time to go through the details to check on the above, but after a quick check, I think you might be happier with pander::eval.msgs, no?
> eval.msgs("print(1:3)")
$src
[1] "print(1:3)"
$result
NULL
$output
NULL
$type
[1] "integer"
$msg
$msg$messages
NULL
$msg$warnings
NULL
$msg$errors
NULL
$stdout
[1] "[1] 1 2 3"
Yess, I just tried it! That's so helpful!! Thank you so much :D