I get the shapeline of newyork census tract from library tigris,after i have a lot of point,in coordinates get from the new york police department
library(tigris)
tracts <- tracts(state = 'NY', county = c(5, 47, 61, 81, 85), cb=TRUE)
for the reproducibility i put some of my point coordinates:
mydata=
Latitude Longitude
1 40.71108 -73.85472
2 40.66888 -73.93251
3 40.82708 -73.86241
4 40.68076 -73.95389
5 40.82449 -73.91253
6 40.88475 -73.86385
7 40.76403 -73.97858
8 40.72972 -73.86397
9 40.86285 -73.89958
10 40.57603 -74.09003
11 40.65729 -73.73765
12 40.84034 -73.92200
13 40.76732 -73.98430
14 40.76039 -73.91510
15 40.72176 -73.84581
16 40.69129 -73.91738
17 40.57487 -74.16973
18 40.61622 -74.03403
19 40.63404 -73.96016
20 40.75528 -73.93629
The main problem (i think) is that Coordinate Reference System (CRS) arguments of my data is NA.So when i try to intersect mydata with tracts, my result is NA,even if i plot the two things together i get only the image of tracts without mydata. I tried, watching around the web:
proj4string(mydata)<-proj4string(tracts)
But this didn't solve my problem.
edit: Also i tried to read the shapefile with readShapePoly that lose the CRS,but it didn't work.
mydata
are inverted.