R Data Cleaning Guided Project

Screen Link:

My Code:
The answer key linked in the guided project looks like this:

survey_select <- survey %>%
  filter(schooltype == "High School") %>%
  select(dbn:aca_tot_11)

What I expected to happen:

What actually happened:

 survey_select <- take3GenEd %>%
     filter(schooltype == "High School") %>%
     select(dbn:aca_tot_11)
Error: object 'schooltype' not found

[As you can see form the difference in dataframe name, I named mine differently than the example.]

I’m running into trouble on page 4/8 of the guided project in the R Data Cleaning guided project.

I looked through all of the datasets the project asks coders to use. The metadata file “Survey Data Dictionary” does list a variable called “sch_type”, however, looking through the other datasets, there does not appear a column called either “sch_type” or “schooltype” in the combined.csv file, masterfile11_d75_final.xlsx file, or the masterfile11_gened_final.xlsx file which coders were asked to download from https://data.cityofnewyork.us/Education/2011-NYC-School-Survey/mnz3-dyi8. I can’t locate the column I’m supposed to filter. Help?

Can you post your notebook here via upload? Secondly, how did you import the data? for instance in the solution survey <- read_tsv("masterfile11_gened_final.txt") is how the survey variable is created

Secondly the spec() function will give you column names for each dataframe

I am guessing that this is what you wanted to generate that variable
take3GenEd <- read_tsv("masterfile11_gened_final.txt")
Then run the following spec(take3GenEd) This will show you the column names

Also this is a handy guide for r errors R Basics Book

Try that and it should work.

1 Like