I have spatial data (polygons) and I want to create a mean based on the three columns. I think I must create a new column to calculate the mean based on the three existing columns.
Asked
Active
Viewed 48 times
0
-
4Welcome to SO. You should add a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), so it'll be a lot easier to help you. Use `sf` package to read your polygons. Then you can use `mutate` from `dplyr`. – patL Jun 20 '19 at 08:11
-
See `?rowMeans`. – Rui Barradas Jun 20 '19 at 08:33
-
library(raster) library (rgdal) library (sf) balprof <- readOGR("/home/vlad/Documents/vldZ/Master/Baltati/Baltati/Vectori/Prof_Baltati.shp") # a polygon shape with 36 columns . So I have 4 columns of pH values and want to create a column of the mean of the ph – Alex.V Jun 20 '19 at 08:34