Skip to content

R vs IDL & Excel

August 29, 2012

Some remote sensing folks use IDL and Excel to analyse their data. They take the ratio of a pair of reflectence values and correlate them against known values of some parameter. However, because they have a large number of bands, they compare a large number of bands to the known values, comparing the models with r2 or some such criteria.

I helped a friend do this over the last couple of days. Using a number of for loops, we created the ratios and then calculated linear, polynomial and non-linear models. Using some simple dataframe reordering, we sorted the models by fit (using AIC as r2 doesnt make sense for nonlinear models) and refit the best 20 or so models, validating them against some data not used to construct the original model.

The code (about 500 lines including quite a lot of comments) took about 2-3 hours to write (me teaching what bits of the code do along the way, so perhaps an hour and a halfs coding normally) and runs in about 5 minutes. I have no idea how long the IDL equivalent code takes to run, but doing this in the usual software environments, a mixture of IDL and Excel Im told, would take about a week.

I wonder what/how many other scripts written in other languages that are in common use would be much quicker in R (not that R is an especially fast language).


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: