Archives
Categories
Category Archives: R
Labeled boxplot in R
As generated by R’s boxplot function. I individually labeled the median, quartiles, min, max, and outliers for inclusion in a presentation where the audience can’t be assumed to know how to interpret box plots. Please feel free to use this … Continue reading
Posted in R, Statistics, Visualization
Leave a comment
Unique is broken in R
Are you kidding me? $ R > unique(1,1,2,3,4) [1] 1 This was the source of yesterday’s nasty to track down bug. What you really want is unique on a vector, as in: > unique(c(1,1,2,3,4)) [1] 1 2 3 4 I … Continue reading
Posted in Programming, Programming Languages Suck, R, R Tip, Suck
Leave a comment
Finding the sort order of an array in R or Ruby
Suppose you have an array that you’d like to sort by another array. A common use case might be a set of arrays of somethings and for each something you generate a score in say [0,1]. Now you’d like to … Continue reading
Posted in Programming, Programming Languages Suck, R, R Tip
Leave a comment
Getting the value of a variable from a string in R
It’s often convenient to use reflection to get the value of a variable from the name as a string. In R, you can use the get function to do this. In R : blog $ R > x = 3 … Continue reading
Posted in R, R Tip
Leave a comment
Interactive Plotting in R
There are many ways to compare univariate distributions; one of my favorites is violin plots. However, if you are only comparing two distributions, then the best solution is often a scatter plot. To that end, I’ve build some code that … Continue reading
Posted in Data Munging, Plotting, R, R Tip, Visualization
Leave a comment
Querying Postgres or Greenplum From R on a Mac, Installation Instructions
NB: this works on 64b versions of R; I tested it with the R64 app with R version 2.10.1 on Snow Leopard Step by step instructions for talking to Postgres or Greenplum: install macports install postgres; I used 8.4 sudo … Continue reading
Querying Databases From R on a Mac
I use a mac, currently running OS 10.6 / Snow Leopard, and I’d like to query our greenplum / postgres database from R. This used to work with R 2.9, but I unfortunately had to upgrade R, and R 2.10 … Continue reading
Posted in Data Munging, R, R Tip
Tagged greenplum, postgres, R and Databases, R Tips
Leave a comment
Querying Postgres or Greenplum from R on a Mac
So, I’m using snow leopard, and I want to query our postgres / greenplum database. First things first: I’m familiar with the RODBC package on CRAN. This installs fine, since it’s a binary package. I also installed the ODBC Administrator … Continue reading
Posted in Data Munging, R, R Tip
Tagged greenplum, postgres, R and Databases, R Tips
Leave a comment
Plotting in Grids
This is post #12 in a running series about plotting in R. I regularly find myself wanting to show arrays or grids of plots in R. This is straightforward using par and mfrow as long as you want a symmetric, … Continue reading
Querying Databases in R
One of the first things you’ll want to do in R is set it up to talk to databases. The easiest way to do this is using ODBC, via package RODBC. To get the package, run > install.packages(RODBC) Once you … Continue reading
Posted in Data Munging, R, R Tip
Tagged data frame, greenplum, mysql, postgres, R and Databases, R Tips
Leave a comment