Skip to content

Comments

better call source(..., local=TRUE)#11

Open
shrektan wants to merge 1 commit intonstrayer:masterfrom
shrektan:patch-1
Open

better call source(..., local=TRUE)#11
shrektan wants to merge 1 commit intonstrayer:masterfrom
shrektan:patch-1

Conversation

@shrektan
Copy link

From the documentation of ?source, we know that the local argument:

FALSE (the default) corresponds to the user's workspace (the global environment) and TRUE to the environment from which source is called.

It means if we call source() without specifying local=TRUE, the global environment will be polluted.

It has no differences if you just use RStudio IDE and click the knit button, as RStudio will evaluate the knit in a separate R session.

However, if you want to knit the Rmd file via R commands, local=TRUE is preferred, in my opinion.

Anyway, it's a very very trivial issue, please feel free to close it if you don't think it's necessary.

Thanks.

so that it won't pollute the global environment
@shrektan shrektan closed this Nov 18, 2020
@shrektan shrektan reopened this Nov 18, 2020
@nstrayer nstrayer force-pushed the master branch 4 times, most recently from 474ef38 to 1f04931 Compare March 28, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant