Publications by Eldon
Comparing hist() and cut() R functions
The other day a question about faceting data came up in the Dallas R Users group (link of conversation). The hist() function is more efficient and uses less memory than the cut() function. Additionally, hist() returns an object that makes it easy to extract the components of interest based on how you faceted your data. The cut() function returns ...
1151 sym R (519 sym/2 pcs)
Export R plot to Illustrator or Inkscape
Have you ever exported an R plot as a PDF and tried to edit it further by importing the PDF into a vector graphics program like Adobe Illustrator or Inkscape? What typically happens is the points on the plot get converted into text of some sort, usually the letter “q”. To avoid this problem simply export your file as a postscript and it works...
922 sym 2 img
R Studio and Revolution R impressions
I have used R for about six years now. Over the years I’ve done the majority of my coding in Linux and so R has been nothing more than a terminal. I enjoy the simplicity and purity of the terminal but have recently given R Studio and Revolution R a try. R Studio is a free and open source IDE that can be run on Windows, Linux, Mac, or even over...
2518 sym 4 img
Reordering factor levels in R plots
A few days ago a post doctoral researcher asked me if I could help him reorder the factor levels on a bar chart. The problem is that R automatically alphabetizes factor levels. I thought this would be fairly straight-forward but I was wrong. If you have a more elegant solution to this problem please comment, but this is my best workaround. I will...
842 sym R (737 sym/1 pcs)
Expand delimited columns in R
A postdoctoral researcher asked me the other day to help him expand a vector of comma delimited values so he could do computations in R with it. I wrote an R function to solve the problem. Here is the before and after: > data Name Score1 Score2 1 Bill 1,3,4,3,6,9 F1,F3,F2 2 Bob 3,2,3 F2,F2,F4 3 Sam 2,5,3 F5,F2,F4 > expand.d...
627 sym R (1423 sym/1 pcs)
Dallas R Users Group Baseball Data Dive
This past Saturday I led a data dive workshop for the Dallas R Users Group using Lahman’s baseball statistics. After providing a brief introduction to the Lahman R package and showing how to load the data and make some basic plots, I had the ~20 people in attendance begin working on the following questions: Visualization: Visualize how the g...
2529 sym 2 img