How to transform data frame to spatial coordinates

Viewed 214

I have a dataset with lat and lon numeric coordinates. I would like to add a "spatial point" column, as described in the sf package. I do not understand much of spatial data but, here a a reproducible example:

   data<-data.frame(Other_column=c("Street Presidente","Street",".",".",".","."),
                    RS=c(55,56,87,98,25,12),
                    longitude = c(28.6979, 53.0046, 4.3261, 24.9019,26.7328, 53.2439), 
                    latitude = c(-7.4197, -4.7089, -6.7541, 4.7817, 2.1643, -5.65)
                    )

   data

 Other_column            R$    longitude   latitude
 "Street Presidente.."    55     28.6979   -7.4197
 "Street ..."             56     53.0046   -4.7089
     .                    87      4.3261   -6.7541
     .                    98     24.9019    4.7817
     .                    25     26.7328    2.1643
     .                    12     53.2439   -5.6500

And I want something like a new column in the data frame that contains a column containing geometric information (geom_point) on the lat/long than can be interpreted by the other spacial funcitons in sf (and the gdal/cgal ecossystem).

Other_column            R$     longitude  latitude  geom_point
"Street Presidente.."    55     28.6979   -7.4197        
"Street ..."             56     53.0046   -4.7089         
    .                    87      4.3261   -6.7541        
    .                    98     24.9019    4.7817        
    .                    25     26.7328    2.1643        
    .                    12     53.2439   -5.6500
0 Answers
Related