Category Archives: Programming Languages Suck

Unique is broken in R

Are you kidding me? $ R > unique(1,1,2,3,4) [1] 1 This was the source of yesterday’s nasty to track down bug. What you really want is unique on a vector, as in: > unique(c(1,1,2,3,4)) [1] 1 2 3 4 I … Continue reading

Posted in Programming, Programming Languages Suck, R, R Tip, Suck | Leave a comment

Formatted numbers in Ruby

In C or C++, it’s can be a pain to get thousands separators in printf. In ruby, it can be trivial, as long as you use the right libraries. If you have ActiveSupport installed (which I believe comes with Rails), … Continue reading

Posted in Programming, Programming Languages Suck, Ruby | Leave a comment

Finding the sort order of an array in R or Ruby

Suppose you have an array that you’d like to sort by another array. A common use case might be a set of arrays of somethings and for each something you generate a score in say [0,1]. Now you’d like to … Continue reading

Posted in Programming, Programming Languages Suck, R, R Tip | Leave a comment

Prepping the Reuters 21578 classification sample dataset

I’ve been playing around with some topic models and decided to look at the Reuters 21578 dataset. For your convenience, this dataset is stored as xml split between 20 files or so. And invalid xml at that. I prefer to … Continue reading

Posted in Classifiers, Programming, Programming Languages Suck | Leave a comment

Thousands Separator in printf in C++

I’ve unfortunately been writing some C++. It’s the crappiest language in the world. I just wasted 90 perfectly good minutes attempting to put thousands separators in numbers that I’m printf ing. If you naively read the man pages, it looks … Continue reading

Posted in Programming, Programming Languages Suck | Leave a comment