how to speed up an R for loop?
问题 I am running the following for loop for the gwr.basic function in the GWmodel package in R. What I need to do is to collect the mean of estimate parameter for any given bandwidth. the code looks like: library(GWmodel) data("DubVoter") #Dub.voter LARentMean = list() for (i in 20:21) { gwr.res <- gwr.basic(GenEl2004 ~ DiffAdd + LARent + SC1 + Unempl + LowEduc + Age18_24 + Age25_44 + Age45_64, data = Dub.voter, bw = i, kernel = "bisquare", adaptive = TRUE, F123.test = TRUE) a <- mean(gwr.res$SDF