R: Quick program I put together