How to convert a data frame to spatial coordinates

I have a dataset with full and complete coordinates. I would like to add a "spatial point" column as described in the package sf

. I'm not very good at spatial data, but here's 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 dataframe that contains a column containing geometric information (geom_point) at lat / long, than can be interpreted by other spatial functions in sf

(and godal / 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

      

+3


source to share





All Articles