Open karen-liz opened 4 years ago
You're really close!
Ultimately, you want to pare down or subset the downtown
data to only those delinquent on taxes, or downtown$amtdelinqt > 0
. You've done that by putting the correct conditional statement on the left side of the comma in brackets [ , ]
.
However, you'll want to leave the right side of the comma empty, since the left side subsets your rows, and the right side subsets your columns. By leaving it empty, you tell R that you don't have any conditions for selecting columns, and therefore R should keep all the columns in the downtown
data.
Then you can call function table()
on your these.landuse
object! Give it a try and hope this helps!
Thanks! I'm glad I was on the right track!
I continue to get this error but I'm not sure why since I'm not using a unique function.
We also want to emphasize the usefulness of logical statements with this lab. It's the syntax we use to translate from plain English to computer code.
Your approach works, but you are subsetting the data to isolate the delinquent cases then analyzing land use within the subset.
Alternatively, we could look at a table of land use and delinquency. You did this last time looking at homes with high value and neighborhood. You just need to translate the numeric vector into a catgorical one first. So:
delinquent.yes.no <- amt > 0 # all late cases TRUE and FALSE
table( landuse , delinquent.yes.no )
Gives you a compact way to define your group quickly (delinquent) and count cases across subcategories (landuse) ->
just have to translate everything into groups first.
If your question starts with, "how many..." or "what proportion of..." chances are you can answer it quickly using logical statements and your code will be cleaner because your logic is explicit in the statement itself instead of implied by subset steps.
Super helpful thanks!
Hello everyone, I can't seem to figure out how to go about question 8. This is what I currently have with the professor's guidance but it seems I didn't fully understand. Any guidance is appreciated!
Thanks!