Can you explain this behaviour when rendering in a new env

Hello,
I cannot explain the following behaviour.
I created a #!/usr/bin/Rscript which

  • defines a list p
  • calls rmarkdown::render(my file.R, param = list(config = p$config, env = new.env())

In my file.R I define a list also called p. I actually define it as global with p<<- stuff
When I launch the script I am being told p is not known.
When I change p to say opt in the Rscript calling script everything works.

I thought asking render to define a new env would make sure the 2 p would not clash, do I miss something ?

PS: sorry I can not produce a reprex right now, I hope this is trivial enough so it can be answered as is.

Can you at list share pieces of code to understand better ?
Not knowing what you do inside myFile.R is not helpful to answer correctly.

do you mean env as the argument of render ?

rmarkdown::render(my file.R, param = list(config = p$config), env = new.env())

I don't understand why you use <<- here ?

Hello @cderv I tried to replicate this but I cannot.
This is likely something strange with my local session at the time.
Sorry for the bother

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.