VIS-2129-F2020 / jiwonpark-vis

0 stars 0 forks source link

Question for the Assignment-5 #7

Closed jiwonpark1994 closed 4 years ago

jiwonpark1994 commented 4 years ago

Hello Carole, here is my Rmd file for the assignment-5 (https://vis-2129-f2020.github.io/jiwonpark-vis/Assignment-5.Rmd) As posted on canvas, my problem is the last code chunk trying to calculate the area of the isochrones. While I was trying to calculate and compare isochrone areas, I got this error message: _Error in FUN(X[[i]], ...) : 'list' object cannot be coerced to type 'double'.

Thank you! Jiwon

c-voulgaris commented 4 years ago

There are two main problems here:

(1) You're using the Cambridge street network, but all your locations are in Boston.

Change lines 34 - 38 to

opq(bbox = 'Boston MA USA') %>%
  add_osm_feature(key = 'highway') %>%
  osmdata_xml(file = 'OTP/graphs/default/boston_streets.osm')

You may want to delete cambridge_streets.osm from your OTP/graphs/default folder (which doesn't seem to be present in your repo or your .gitignore file - do you have it on your local computer?)

Update your code throughout to refer to Boston rather than Cambridge (unless you want this to be an analysis of Cambridge polling location - in which case you should get polling locations for Cambridge rather than for Boston).

(2) You have duplicate points in your set of polling locations - e.g. two polling locations in the same location. You can remove duplicate points by adding this lines somewhere before you create the isochrones:

poll_location <- st_difference(poll_location)

And that will delete the duplicate points.

That should resolve the specific error you're getting.