Not saving as integer

how i can save p1 and p2 as integer being a lat and long in data frame

library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
    p1 <- data.frame(
      lat=runif(5,29,32),
      long=runif(5,69,74)
    ) %>%
      st_as_sf(coords = c("lat","long"), crs = 4326)
       p2 <- data.frame(
      lat=runif(5,29,32),
      long=runif(5,69,74)
    ) %>%
      st_as_sf(coords = c("lat","long"), crs = 4326)
   
    nrow(st_join(p1,p2, join = st_equals, left = FALSE)) == nrow(p1)
#> [1] FALSE

Created on 2020-02-09 by the reprex package (v0.3.0)

You can coerce doubles into integers with as.integer(). For example,

as.integer(runif(5,29,32))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.