RRC|BIOSTATISTICS

R, Emacs on Windows

I’ve been doing a tremendous amount about data cleaning in R. Its a bit of a champagne problem because I’m learning while doing. Now, I’ve done such clean up before with SAS/SPSS for just under 200 patients. Now there are thousands of medical records to sort through so I knew I needed to get Emacs and R up and running right away on the Windows work terminal.

When install.packages() fails you.

Sometimes, when you attempt to install a package, the buffer reads “—– Please select a CRAN mirror for use in this session —–” and that little ‘R’ clock will just keep turning and turning turning. I learned quickly that pop-up windows with Emacs in Windows 7 don’t work. Or maybe its government computers that are the problem. Either way, Le sigh.

Option 1: Create a .Rprofile I learned that like Emacs and ZSH, R has its own customizable profile. The trick is that it needs to be in your etc folder. That folder is among the other directories such as include, modules, share, src, tests. Here is the approximate directory path: C:\User\Documents\R\R-3.0.2\etc Just like your .emacs folder, type in your terminal emacs .Rprofile or, if in Windows type SUPER + emacs then C-x f .Rprofile in the directory of your choice

Option 2: Enter in R Type options("menu.graphics"=FALSE) You’re done.

Pre-set Your Chosen Cran Mirror

Option 1: Go back to your .Rprofile, and add this.

1
2
options(repos=c(CRAN="http://yourchosencranmirror"),
        papersize="a4")

Option 2. Enter it manually within R.

1
2
3
4
r <- getOption("repos")
r["CRAN"] <- "http://cran.stat.ucla.edu"
options(repos = r)
rm(r)

Comments