- Wordfile for R. See UltraEdit for installation reminders. But it's syntax highlighting is broken when using square brackets.
- What are the HOME and working directories? For you, this is
help(Startup)for the intricate details. You can create a
.Rprofilein this directory to initialize settings.
- Your settings are located in
- Revolution Analytics version of R. Free for academics after filling out form. This could be a really useful tool except that the Console colors are somewhat annoying and can't be changed (in particular, the background color).
- The R Project
- A list of books for learning the R Language. The R Book, available electronically at NCSU.
- If you get annoyed with the "Save workspace image?" prompt on exit, you can add
--no-saveas an argument. Or, if you want to automatically save, use
- When you want to run a script from the command-line (or through UltraEdit), use
Rscript. All the other random binaries are left overs.
tapply(table apply) function is useful, but still looks too complicated for me.
- It's good practice to use
- An R style guide, based on Google's style guide for R.
- Quick-R home page, also for the book R in Action.
- Notes on the use of R for psychology experiments and questionnaires.
- To read a CSV file use
read.csv. Remember to set set
header = TRUE.
read.tablealso returns a data frame, but has many more options.
- If you want counts, there are many ways to get it:
- To serialize structures to disk, use
- You can move data between Excel and R using clipboard!
- For integer binning, you can use the
- Libraries are useful. To see the installed libraries, use
library. To include a library, say
- fitdistrplus has useful functions for AIC and BIC.
- Installing packages is easy:
install.packages("akima"). You can also update packages with
- To see which packages need updating, use
old.packages(). You can also use
library()(less verbose) to see which packages you have installed.
- To search for packages, use
Installing R Under RHEL
- After setting up EPEL, we find that the package is simply called R.
This section contains notes on installing RMySQL under Windows, which is a considerable chore, since almost every site is incomplete for some critical detail.
It doesn't seem like it's possible to get this working under
R-2.15.0, using binary builds. This means that you'll have to compile the package using the source. These instructions are specific to the 64-bit version of R in Windows; the 32-bit version has some minor variations from this.
Warning message: package ‘RMySQL’ is not available (for R version 2.15.0)
- Okay, start by grabbing RTools, which will just make you go to
<CRAN mirror>/bin/windows/Rtoolsanyway, so here's the UCLA mirror. Make sure RTools is in the front of your path (to avoid clashes with anything like
- The path should thus include
C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin(see Appendix D).
- Install MySQL Community Server, with development components. Then, set
C:\Program Files\MySQL\MySQL Server 5.5, except that you actually need the short name version! I haven't found a good way to find this except through repeated application of
dir /xfrom this discussion.
- For me, the short path ends up being
libmySQL.dllinto the MySQL
- As an alternative to adding it to your path (though this didn't work for me), you can instead add it to Renviron.site. Normally, this file isn't created by default, so you'll have to make it and put it in
/etc. If you don't know where this file is, use
R.home()at your R prompt.
- Use the command:
install.packages("RMySQL", type = "source").
- Some discussions about RMySQL on stackoverflow.
R.exe, not through
Rgui. You can run it through either, but I use the command-line version just for isolation.
- Additional RMySQL Installation Notes from Vanderbilt. Some instructions by Jeff Walker.
- Some relatively old instructions.
In R 2.15.1, if you don't have the
PATH correct, you'll end up with an error such as:
RS-DBI.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
To ensure that R is functioning correctly:
> Sys.getenv("MYSQL_HOME")  "C:/PROGRA~1/MySQL/MYSQLS~1.5" > library("RMySQL") Loading required package: DBI MYSQL_HOME defined as C:/PROGRA~1/MySQL/MYSQLS~1.5
The official instructions claim that
MYSQL_HOME is needed only during installation, not loading, but I have not found this to be the case:
MYSQL_HOME needs to be set at all times.
- For comparing distributions, you can use Kullback-Leibler. This shows up multiple times: seewave and
- For t-test, use
t.test. For chi-squared, use
Plotting seems to be exceedingly difficult in R.
- ggplot2 is a plotting system for R, which tries to take the good parts of base and lattice graphics and none of the bad parts. ggplot2 documentation. You can install
- Pearson's R using
- Couple Python and R with RPy. Unfortunately, the authors has stopped providing Windows binaries with
rpy2. If you're using straight Python,
scipymay be an alternative.
gsubfn(simpler alternative may be to use
sprintf; there is also
paste). Sanitize your data first, since this is open to SQL injection attacks.