Homework Questions? Ask a Tutor for Answers ASAP
1. To do: Identify rows in the data that have the following error. For some child id, some friend ID's were written multiple times in one row. Find all of these errors and produce an excel spreadsheet with row numbers where this error occurs (do not fix them; Amori needs to fix them).
2. To do: Fix the following error. When the child is by him/herself, the quality variable should always be N/A. Attached is the data file
That would be great!
It would be preferred if it was written in R as there are other scripts that deal with the data set that have already been written in R and would be easier to integrate all of them.
To Do #1: For example if I looked at row 7858, it will have session 1, day 10, childid 664, coder kanesha, column f1 through f10 represents the id of children which childid 664 was playing with at the time, if for example 506 is written twice in any of the f1-f10 columns then the script should output this as an error in an excel spreadsheet indicating which row and column it was found (this is not a real example from the data, but it gives you an idea of what needs to be looked for in the data)
To Do #2: For example say row 2, session 1, day 3, childid 501, coder Katie, if all of the columns f1-f10 are NA then the column quality should also say NA (not 2 or 1) note: this is also not a real example from the data
Thank you! Hope this was a clear explanation. Please let me know if you need any more details.
With the following: excel file must first be saved as csv
# XXXXX working directory
#read in excel file setwd("C:/Users/Jenny PC/Documents/Academics/Amori and Vika") #this is your working directory where the data file is saveddata = read.csv("New Data - August 16 2013.csv")
and then outputting excel spreadsheet with the following:
write.csv(data,"C:/Users/Jenny PC/Documents/Academics/Amori and Vika/Output Stuff/New Data.csv")
this is the working directing where you want the output produced and the name of the csv you want.
Are you able to provide comments on your code so that I am able to know what each line is doing?
Also did you do part 2 of this as well? or just the first part?
Thank you! You were a great help!