My new favorite thing is the foreach library. It lets you do all of the nice apply things, but with a somewhat easier syntax:
list_powers <- foreach(i = 1:100) %do% {
lp <- x[i]^i
return (lp)
}
The best part is that if you are doing something that actually requires a significant amount of time, you can switch from %do%
to %dopar%
(with the appropriate backend library) to instantly parallelize, even across a cluster. Very slick.