Blog Archives

“Inside” Functors — Multiple Arguments

April 27, 2011
By
“Inside” Functors — Multiple Arguments

Again for HTML reasons this has been taken to http://strugglingthroughproblems.blogspot.com/2011/04/inside-functors-multiple-arguments.html

Read more »

“Inside” Functors

April 26, 2011
By
“Inside” Functors

So, WordPress doesn’t like RweaveHTML, so this is posted at http://strugglingthroughproblems.blogspot.com/2011/04/inside-functors.html

Read more »

Complex-valued linear models

September 16, 2010
By
Complex-valued linear models

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
By
R SQL-ish aggregation

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
By
Subset views in R

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 »

Matlab-style multiple assignment in R

August 26, 2010
By
Matlab-style multiple assignment in R

R again! You know how in Matlab you can do? S, I = sort(M) I like that. R generic functions makes this possible. First, let’s genericize assignment. I feel like regular “=” and “<-” oughta stay nongeneric, so let’s make … Continue reading →

Read more »

Packing everything into a data.frame

August 23, 2010
By
Packing everything into a data.frame

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
By
Rearranging definitions in R

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 »