Optimization

How to add a progress bar to a function in R

Older readers of this post may remember the boot screen from Windows XP. This featured a load bar that was there to essentially give a user the message: “Hold on a minute, the computer is starting. Please chill out and don’t turn the machine off, that might cause some problems!” This load bar was a bit of a hack, as it didn’t increment with the progress of the boot… it just played a little animation over and over again to calm the user down.

Vectorizing the application of R functions for speed and simplicity

When applying a function to a vector, list or dataframe column, your first instinct may be to iterate across the series of inputs. By doing this each value is touched one after the other and the outputs can be generated consecutively. An extremely useful feature of R is that functions can be vectorized. What is meant by this is that instead of the function being applied to each list member consecutively, it is applied to each member of the vector at the same time.

Engineering features to improve house price predictions