Caching objects in R