Articles by ellbur

Do older SOers use fewer words?

August 18, 2011 | ellbur

On StackOverflow, to posters with more experience ask their questions in fewer words? No. There's no visible difference: Chars of non-code: Chars of code: The data comes from the super-handy StackOverflow API, which was retrieved using wget and then parsed using rjson and XML. First read in and parse the ... [Read more...]

Reverse Iteration

July 3, 2011 | ellbur

Time to horrify some people. First let's include the code we wrote last time, __ source("pretend.R") and the dependency-tracking environment it creates will be used to run all the following examples. Let's look at, I don't know, I'm just trying to demonstrate a language feature so uh... band-pass filtering ... [Read more...]

RObjectTables are AWESOME

June 26, 2011 | ellbur

Why isn't everyone using the RObjectTables package? This is the best thing ever! Here's the basic idea of RObjectTables: An environment is an object where you can lookup names and associate them with values. And in particular its where you look up variables used in an expression. But there's no ... [Read more...]

Inheriting in Items

June 23, 2011 | ellbur

What if we want to extend the behavior of one item with another? Or, to put it another way, what if we want one item to be able to grab the functionality of another? It turns out we can (almost) get this behavior without modifying the item constructor at all. ... [Read more...]

Items

June 22, 2011 | ellbur

Let's define a new pattern! I do a lot of programming for research, and part of what this involves is turning calculations, usually expressed as verbs, into nouns. That is, I need to keep the calculation and all it's intermediate steps around so that I can inspect them. Alas, I ... [Read more...]

The R WikiBook

June 21, 2011 | ellbur

Tal Galili, god bless him, is rounding up R bloggers for an R WikiBook In support of this book I am announcing all R-related content I post (here and at the old site) to be available under a cc-by-sa license (not that I'd really care if you didn't giv... [Read more...]

Corresponding

May 7, 2011 | ellbur

(The examples here work with the version of insidefunctor tagged as "v2") Unfortunately I couldn't do this cleanly outside the library. So the changes are made in insidefunctor. Levels are no longer used to "line up" eaches. So, for example, __ library(insidefunctor) __ `%+.%` = fmap(`+`) __ `%/.%` = fmap(`/`) __ x = c(1, 2, 3) __ y = c(4, 5, 6) __ .[z] = each(... [Read more...]

"Inside" Functors — Evaluating things more than once

May 1, 2011 | ellbur

(The examples here work with the version of insidefunctor tagged as "v1") I ran into an interesting problem using "inside" functors. Something is wrong in the following code (well, depending on what you thought it should do). __ library(insidefunctor) __ `%+.%` = fmap(`+`) __ x = seq(0, 10, len = 50) __ plot(x, collect(each(x) %+.% runif(1))) It's ... [Read more...]

Complex-valued linear models

September 16, 2010 | ellbur

Someone has probably already written code to do this. But I couldn’t find it in CRAN, so here goes. Oh no lm() won’t take complex numbers! (or rather, it’ll take them, but it’ll discard the imaginary part.) Easy enough fix. … Continue reading → [Read more...]

R SQL-ish aggregation

September 10, 2010 | ellbur

I came to R from SQL. I’ve heard that packages such as reshape and plyr are quite beautiful, but to me they are somewhat non-intuitive. I’m always looking for SELECT mean(sodium) as mean, variance(sodium) as var FROM texas GROUP BY … Continue reading → [Read more...]

Subset views in R

August 28, 2010 | ellbur

I don’t know how to do this in R. So let me just say why I can’t. I wanted something akin to Boost‘s sub-matrix views, where you can have indexes map back to the original matrix, so you don’t create … Continue reading → [Read more...]

Packing everything into a data.frame

August 23, 2010 | ellbur

OK, I know I talk about R too much, but I like R, so I’m going to talk about it some more. Common situation: repeat a procedure many times; each time generates some large wadge of awful-structured data, and in … Continue reading → [Read more...]

Rearranging definitions in R

May 6, 2010 | ellbur

I came up with a handy little trick for programming in R. I like to define a lot of variables all at once without worrying about what order they’re in. The goal would be something like this: K  = -R2/R1 … Continue reading → [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)