0

I'm a beginner in R and do with that my homework. I want to change the coordinates of some point to draw my country weather station like this:

stations <- read.csv("Stations.csv")
coordinates(stations)<-~lon+lat
plot(stations)

like this image:

enter image description here

my data are like this:

enter image description here

but at the first I want to start and install the coordinates package, this error is shown:

"  package ‘coordinates’ is not available for this version of R   "

please help meو what can I do?

  • 1
    (1) Don't share images of data, I won't spend the time to transcribe your data into something usable. (2) `coordinates` is not a package, it's a function, and it is in the `sp` package. Start with `library(sp)`, and if that fails then try `install.packages(sp)` (and then `library(sp)` again). – r2evans Apr 27 '21 at 16:43
  • I'm guessing that you first encountered the error `could not find function "coordinates"`, in which case this is a duplicate of https://stackoverflow.com/q/7027288/3358272. Please reply when you've tried my above steps and whether it works. Thank you! – r2evans Apr 27 '21 at 16:47
  • 1
    yes I was wrong thank you so much – Mohammadmehdi Rasouli Apr 27 '21 at 18:56

1 Answers1

0

coordinates is not a package, it's a function, and it is in the "sp" package. Start with library(sp), and if that fails then try install.packages(sp), and then library(sp)