“It works pretty slow” is very vague. There are many methods for the most efficient use of R, the general rule is to “avoid loops and vectorization,” but there are many more, for example, so that objects are pre-distributed and not changed on the fly.
It really depends on what you are doing, so please be more specific. There are a lot of basic tips in the standard documentation, and your question does not allow anyone to do more than tear them down.
When the standard R is really limited for your needs, you can write directly in a compiled language like C, or use advanced interfaces like Rcpp. For other tools and methods that go beyond the core R toolkit, refer to the CRAN task view.
mdsumner
source share