gabors-data-analysis / da-coding-rstats

Coding course to complete Data Analysis in R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove rm from beginning

korenmiklos opened this issue · comments

https://www.tidyverse.org/blog/2017/12/workflow-vs-script/

What is the standard practice for R? I understand that workspace is permanent between RStudio sessions (unlike Stata), which makes rm useful, but also very dangerous if some stores valuable stuff in their workspace.

Totally agreed with the "SET YOUR COMPUTER ON FIRE" argument 👍 😄

I always suggest students disable automatic saving/restoring of R workspaces in the RStudio settings to urge them to write reproducible scripts.

I use this example at some of my classes to demo rm/le (and running R scripts from online sources) shortcomings:

https://github.com/daroczig/CEU-DV2/blob/18b927e894f3b506e78514c3553b68cd7e37f5b6/1.R#L44

Thanks for these points! Made me sure to include in the first lecture to show students how to disable automatic saving/restoring of R workspaces in the RStudio setting. No question about it.

However, not sure on if we should remove rm( list = ls() ). I see the points made both by @korenmiklos and @daroczig, however, I have struggled multiple times in the intro courses that students have all kinds of stuff in their global workspace, multiple RStudio opened, etc. To put it differently, the major issues and problems when starting to teach coding (at least based on my experience) are much more basic than the listed problems in the blog or by @daroczig. This does not justify showing them bad habits, but I see at the moment is rm( list = ls() ) rather teaches them to have a properly organized workspace and take care of what and how to run scripts. If this lesson is learned then we can move on to the next step (or actually more advanced R classes will show them this like DV2 :)

But, again if I have missed something/ misunderstood, happy to adopt!

What do you think @gbekes?

So we have discussed the issue in person and decided to keep rm( list = ls() ) at the beginning of the scripts. See our 'argument' here. We encourage users to alter if they disagree with this practice.