0

I am currently working on dataset with different firms. I have each firms' longitude and latitude. I want to find the firms' city locations by using R.

For example, I found that Shanghai's city longitude and latitude range 120.852326~122.118227 and 30.691701~31.874634 respectively.

I firstly want to create a column named "city", and I want to use find if firms' longitudes and latitudes within Shanghai's city longitude and latitude range. If yes, then R will print "Shanghai" in the "city column if not, it will remain NA.

In my dataframe longitude and latitude variables are displayed as "longitude" and "latitude".

I am not sure how to run the code and I am really appreciate your favor and help!

I am really struggling at the beginning. Your help and favor are highly appreciative!

Phil
  • 7,287
  • 3
  • 36
  • 66
  • this question should help: https://stackoverflow.com/questions/42319993/listing-cities-from-coordinates – jalapic Jan 29 '23 at 01:35
  • If you still need help, [please post a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – jrcalabrese Jan 29 '23 at 02:27

0 Answers0