Monthly Archives: September 2010

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

Posted in R | 2 Comments

Starting Apache on first request

I haven’t figured this one out yet. I’m going to describe the things I’ve tried so far. So first, the story. A long time ago you could run apache through inetd. This is kind of a silly thing to do … Continue reading

Posted in networking | Leave a comment

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

Posted in R | 5 Comments

Python method gotcha

Little quirk of Python that drove me crazy. I love Python decorators. I wanted to make a decorator for lazy evaluation. class Lazy: def __init__(self, f): self.f = f self.val = None def __call__(self, *a, **b): if self.val == None: … Continue reading

Posted in python | Leave a comment