Fixed errors in queries, added data manipulation .R and added datafiles