I have a fairly simple task to do but I can\'t finish it because of memory problems. So I am wondering if there is a more efficient way to do this. I have a big data.frame that