خرید بک لینک

Vote count: 0

Below is code for calculating patch statistics on 34 rasters where each raster's name is written as the last column in the output. I'm trying to figure out what I'm missing to have the loop go through all rasters and write their results to one csv. Am missing an i somewhere or does it need to be a raster stack?

library(raster) library(rgdal) library(SDMTools)

m <- "Z:/././"
allFiles <- list.files(m,pattern = "_ex0315.ovr", no.. = TRUE,recursive=TRUE)
allFiles
#allFiles<-stack(allFiles)
for (i in 1:length(allFiles)){
  b1 <- raster(allFiles[i]) 

  b1[b1>0]<-1
  #do the coected component labelling
  ccl.mat = CoCompLabel(b1)


  #calculate the patch statistics
  ps.data = PatchStat(ccl.mat)
  ps.data[,ncol(ps.data)+1] <- allFiles[i]
  write.csv(ps.data, file=paste0(getwd(),names(allFiles[[i]]),".csv"),row.names=F)
}

asked 29 secs ago

برچسب: loop only velcro,loop only once,loop only certain slides in powerpoint,loop only one category wordpress,loop only one layer flash,loop only velcro coins,loop only once in abap,loop only odd numbers,loop only once php,loop only once java, نویسنده: استخدام کار تاريخ: پنجشنبه 18 شهريور 1395 ساعت: 17:59

صفحه بندی