DS4PS / cpp-526-sum-2021

Coure shell for CPP 526.
https://ds4ps.org/cpp-526-sum-2021/
MIT License
1 stars 3 forks source link

Lab 02: Question 7 Part 2 Clarification #13

Open jholwegn opened 3 years ago

jholwegn commented 3 years ago

I'm confused about Question 7 Part 2.

"What proportion of delinquent tax bills are owed by commercial parcels?"

I was able to figure out the code to generate the Tax Delinquent Non-Commercial Properties map shown in the instructions, but I don't understand how it relates to the question.

If the Tax Delinquent Non-Commercial Properties map isn't related, I would like to know if I'm on the right track with this code:

result <- downtown$amtdelinqt & downtown$landuse == "Commercial" mean(result/downtown$amtdelinqt, na.rm = T)

Thank you!

lecy commented 3 years ago

Logical statements are a little tricky.

Compound logical statements need to be combinations of two logical vectors.

You currently have a numeric vector and a logical vector in your statement.

downtown$amtdelinqt    &    downtown$landuse == "Commercial"

Which is probably why you are getting a nonsensical answer.

First define a group for tax delinquent properties then use that in your compound logical statement.

jamisoncrawford commented 3 years ago

@jholwegn how are we on this? Good?

Julia-Hernandez commented 3 years ago

@jamisoncrawford Good evening! I have been mulling over this question all day. I am confused on what my second logical statement should be in order to create a logical vector. I have the same code as mentioned above. Thanks!

jamisoncrawford commented 3 years ago

@jholwegn one approach is to create a subset (smaller dataset) from downtown that contains only commercial properties. We can call it dt_coms:

dt_coms <- downtown[downtown$landuse == "Commercial", ]

Now you have a subset of only commercial properties: dt_coms. What can you do with this subset to get to the right answer?

lecy commented 3 years ago

@Julia-Hernandez how would you operationalize "is delinquent" (true/false logical vector) from a numeric variable like amount of back-taxes owed?

downtown$amtdelinqt

What types of values do you see in the vector?

summary( downtown$amtdelinqt )