Site icon R-bloggers

R installation notes for the occasional R user

[This article was first published on dataism » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In an organization with say, more than 10 people, letting users manage their own installations has goat rodeo written all over it. For this reason, I’m guessing your responsibility for software installations is inversely proportional to the size and sophistication of the organization you work for.

So, if you’re an occasional user of R at home or perhaps the lone statistician in your small office with limited tech support, this post’s for you. One of the things I like about R and other open source software, in addition to accessibility, is the fact that it they are constantly evolving. Similar to Stata and SAS, R has a modular structure. When you download a version of R, it comes with a set of built-in functionalities. Once you’ve installed a version, you can then enhance your installation by choosing from the vast selection of packages contributed by other R users, kind of like a smorgasbord with a lot more quality control.

If you’re like me and not a daily R user, you notice you need an upgrade when you unpack your latest find from R-CRAN and it refuses to load or otherwise play nicely with your base installation. Luckily, your new package should give you a warning message with the version your package was built in.

These instructions are for those of us using computers running the 32-bit version of Windows 7.

Installing R the first time (difficulty level = easy)

Over time, you will likely become a frequent visitor to CRAN, which stands for Comprehensive R Archive Network.

Unless you are ready to build your own R packages, you will only need to download the R Base Package. After downloading the executables, installation is as easy as clicking ‘Next’ two or three times when prompted by the R setup wizard.

Adding Packages (difficulty level = easy)

The R Base Package contains its “basic” functions, which include the standard arithmetic, statistical, and processing tools and some useful, not-as-basic (e.g., “Fuzzy” string matching) functions.

All contributed packages are linked with short descriptions here. It’s easy to be tempted by greed. At the time of this writing, there were 5019 available packages contributed by talented and generous folks to share. Rob Kabacoff has provided a gentle introduction to R packages on his site, Quick-R.

An Example

I find examples helpful, so here’s mine. To analyze survey data, you need special tools to calculate the variance in a way that reflects the sampling design. Josh Pasek’s “Weights” package allows for calculation of weighted frequencies, means, and other statistics with variance estimates that take the design into account.

Here’s an example of the installation command, which will unpack your new module. After invoking the command, the R base software will walk you through the next steps.

install.packages("weights", lib="c:/r/packages/")

Upgrading

As I mentioned at the beginning, R is constantly evolving. It is possible to have two separate versions of R running on your machine. Luckily, Christopher Gandrud is and has written detailed instructions on the management and citing of various R package versions. The good news is also that installing R is incredibly easy and, as mentioned before, CRAN keeps all of the old versions in an archive. So, uninstalling your current version of R and replacing it with a newer one seems like a pretty low risk approach, especially if you are a beginning R user.

Cheers!

To leave a comment for the author, please follow the link and comment on their blog: dataism » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.