> library(sp)
> # transformation du dataframe originel en un dataframe spatial
> coordinates(mes_données) <- ~ x+y
> # résultat
> class(mes_données)
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"
> str(mes_données)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 7 obs. of 2 variables:
.. ..$ id : int [1:7] 1 2 3 4 5 6 7
.. ..$ test: Factor w/ 7 levels "a ","b ","c ",..: 1 2 3 4 5 6 7
..@ coords.nrs : int [1:2] 2 3
..@ coords : num [1:7, 1:2] 235 245 255 265 275 285 295 424 444 464 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "x" "y"
..@ bbox : num [1:2, 1:2] 235 424 295 544
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "x" "y"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr NA