Blog Archives

10 R One Liners to Impress Your Friends

June 5, 2011
By

Following the trend of one liners for various languages (Haskell, Scala, Python), here's some examples in RMultiply Each Item in a List by 2#listslapply(list(1:4),function(n){n*2})# otherwise(1:4)*2 Sum a List of Numbers#listslapply(list(1:4),sum)# oth...

Read more »

Ascii code table in R

March 8, 2011
By

A quick method to enumerate the printable ascii characters with their hex & decimal values.The following code relies on taking the "raw" value of a base 10 int (this gives a hex value), and then using the builtin function rawToChar, which gives a character. You can of course change the range (up to 255). Not sure and haven't tested,...

Read more »

EmEditor R code macro – Almost interactive R development for Emeditor

January 10, 2011
By

Get the new macro now hosted on githubEdit 18th Jan 2011: The below text refers to the old version of the macro and is no longer relevant, a new post will  describe the new macro, and it is also documented on the github site.As a follow ...

Read more »

Plotting time vs date in R

October 2, 2010
By
Plotting time vs date in R

Having done the plot with python+matplotlib, thought I would have a go reproducing it in R, using only the builtin "plot". So, just to recap - this is a plot of the sun times (rise/set,twilight and blinding) as generated by the great python library pyephem. The R code reads in a csv file as output from a...

Read more »

Auto-complete for R in EmEditor

September 20, 2010
By
Auto-complete for R in EmEditor

This will work for any language you have a syntax file for, but I'll use R as the example.1. Open an R file, and on the plugins menu, click "Word Complete"2. Type a couple of letters e.g. rn and then press ctrl+space (default word suggest keyboard...

Read more »

EmEditor Professional as an R script editor

September 11, 2010
By
EmEditor Professional as an R script editor

R is not supported "out of the box" by EmEditor, so here's a few tips I've found for using it as a great editor for R.Code Syntax highlighting Executing R scripts and capturing outputUse ctags symbols to navigate files.If you create packages for CRAN or like neat code, you might like to use a macro to tidy it...

Read more »