Daily Archives: November 23, 2020


CSV to Shapefile in R

  #####Code based on https://erinbecker.github.io/r-raster-vector-geospatial/10-vector-csv-to-shapefile-in-r/index.html #####load libraries library(“sf”) library(“raster”) #####Set working path, input text file name, output shapefile name mypath<- “~/r-docker-tutorial/lIlk” myfile<- “20201015_1130wetland8.TXT” outfile<- “emi_20201015_1130wetland8.shp” #####Read CSV into a data frame named mydat mydat<- read.csv(file.path(mypath,myfile), na.strings = “NA”) nrow(mydat) #####Remove all rows whose longitude value is NA mydat<- subset(mydat, !is.na(mydat$WGS84_LON)) […]