R tips

Rstudio Environment

  1. Clear your workspace (by Aziz Abubshait - Italian Institute of Technology and formerly of GMU's HFAC doctoral program)

Problem: Garbage cleanup - aka running out of memory for your analyses

Description: The norm for R programmers is to go back and forth between executing different lines while skipping others. Therefore, it is a common issue for many to create unwanted variables that could interfere with your code. In the mildest case, you simply overload your RAM with unwanted variables. In extreme cases, you overwrite important and wanted variables to create non-reproducible results.

How do most users solve the problem: Some completely clean their workspace prior to exiting, however, this is not very efficient.

Your solution: Stop RStudio from automatically saving your environment; to do so click: Tools -> Global options -> General -> and from the drop down menu where it says "save workspace to .RData on exit", choose "Never".

Potential problems: You may create unreproducible variables/outcomes/graphs that can be a PAIN to recreate. Be mindful of the flow of your code and the dependencies before you share your code. Make sure your code executes in the order you save it.

  1. Use the preview release (by Patrick)

Problem: Rstudio doesn't have the latest and greatest features

Description: R Studio releases versions routinely but not until most new features get tested extensively. That testing usually comes in the form of Rstudio testers checking for bugs in-house. After bugs are squashed - as they often are quite apparent - the company releases a "preview" of the upcoming release. These previews are frequently updated so check for the latest.

How do most users solve the problem: Don't know. Most give up but some search fruitlessly on Google for answers.

Your solution: Install the preview release. Click on that link and select your operating system.

R - Data Importing

  1. Get your data from the web (web scraping, GitHub, and other public repositories)

  2. Import SPSS files

  3. Generate and re-read csv files