In RStudio, I wrote a program to read a large number of shp files and save only some columns from each shp file.
There are about 20 shp files in the folder, and each shp file is about 100-300 MB in size.
However, as I read more files, the speed becomes extremely slow, and it takes tens of minutes to read and process a single file.
What could be the problem?
Below is the program I wrote...
library(sf)
setwd("C:/Users/aaa/QGIS/ownerinfo/")
files <- Sys.glob("*.shp")
for (filename in files) {
show(filename)
cadastral <- st_read(filename,options="encoding=cp949")
cadastral <- subset(cadastral, select = c(A0,A2,A3,A5,A7,A20))
st_write(cadastral, filename, append=FALSE)
}