High Resolution Graphics, Memory Issues, and WSU security

Today in our troubleshooting session we addressed exporting high resolution figures using R studio. Because R studio does not allow for a resolution increase we use coding that relies on some embedded R functionality, and works great for those that just us native R rather than R Studio. The script does not require any packages as it is base R functions, but it does require the working directory to be the desired destination folder – otherwise you’ll have to search your hard drive for it! The script for that is here: ExportingHighResolutionFigures

We also discussed memory issues in R. R is not very streamlined as far as memory use so there are a few tricks we can use to assist it to be more efficient. The first is using the ls() function. This identifies what products or objects you have currently stored within your R session. The more products you have, the more memory you are using. The ls() command shows the same products that are easily viewed in R Studio in the environment panel on the top left.

If you wold like to remove any products in the environment you can use the rm() command. Place the name of the object you would like to remove within the parentheses and it will be deleted from the environment.

An additional tool for salvaging memory is the gc() command. “gc” stands for “garbage collector” and, while it doesn’t delete any products, it removes memory storage that is associated with deleted or altered products.

Lastly, we discussed a persistent issue at WSU with accessing data from external sources. The current workaround, if you are using a Windows OS, is to specify to R which internet port it needs to use. R’s default port is currently not working for some data retrieval, so using the Microsoft Explorer port is necessary (WSU’s security allows Explorer to get data). The code to do this is setInternet2(TRUE).