Various R Programming Problems