I am creating an analysis workflow for large data sets, but first I have to test it on smaller data sets. What I would like to do is to separate my “selective” data sets from the actual data sets, putting them in such an environment:
sample_data<-new.env() attach(sample_data)
However, when I do this, sample_df_1 and sample_df_2 will be saved in the global environment, not in my sample_data environment. Of course, I can use assign(..., envir=sample_data) , but this is somewhat tedious, and I do not want them to appear in the final code.
It is also not recommended to use with , because the lines of code inside it cannot be executed one after another, which makes it rather inconvenient at the development stage.
I hope to achieve the same behavior as debug and undebug , for example:
switch_to_env(sample_data)
as @Gregor noted, “setting an option” probably better describes what I'm looking for: a parameter that allows the user to specify the environment in which the R REPL evaluates expressions.
Thanks!
Benny source share