Skip to content
Prev 27270 / 29559 Next

add a field to sf object and point shape in kml

Dear Marta,

I have answer only to your first question.
The way you created the new column (a$b = 2) is correct.
The order of the columns and the place of the geometry column are 
usually not so important, but if you want to rearrange the columns, just 
use one of the following lines:
a <- a[, c(colnames(a)[!(colnames(a) %in% attr(a, "sf_column"))], 
attr(a, "sf_column"))]
a <- st_sf(cbind(st_set_geometry(a, NULL), st_geometry(a)))

HTH,
?kos Bede-Fazekas
Hungarian Academy of Sciences


2019.05.07. 13:54 keltez?ssel, Marta Rufino ?rta: