VIS-2129-F2020 / jiwonpark-vis

0 stars 0 forks source link

Question for Assignment-3 #4

Closed jiwonpark1994 closed 4 years ago

jiwonpark1994 commented 4 years ago

Hi Carole and Alex,

I have a question on the assignment (https://github.com/VIS-2129-F2020/jiwonpark-vis/blob/master/VIS%20Assignment-3.Rmd).

My question is about the line 230. I want to calculate the proportion (not the number) of the wifi zones to the number of entire wifi-zones in NYC) in each community district. So I coded like line 230, but it didn't work. This seems the wrong code even for me, but I was not sure what the alternative would be. For your information, "free_wifi" means the number of whole wifi-zones in NYC.

Thank you. I look forward to hearing from you!

bauranov commented 4 years ago

Hi Jiwon, You are dividing a number (num_wifi) by an entire data frame that has multiple columns (free_wifi) which is why you're getting an error. If I understand correctly, you want to divide each num_wifi by the total number of free wifi's. To do that, count the total number of free wifi spots with nrow(free_wifi). Your code in line 230 should be: mutate(pct_wifi = num_wifi / nrow(free_wifi)). Best, Alex

jiwonpark1994 commented 4 years ago

Thank you so much, Alex! It worked in my code:)