Displaying 2 results from an estimated 2 matches for "whichval".
Did you mean:
which_all
2004 Apr 04
1
How to improve this code?
...s=FALSE, col.names=FALSE)
#Trade Area Size
TAsize <- c(100)
custlatlon <- customerlist[, 2:3]
for(i in 1:length(TAsize)){
for(j in 1:nrow(storelist)){
cat("Store: ", storelist[j]," TA Size = ", TAsize[i],
"\n")
storelatlon <- storelist[j, 2:3]
whichval <-
which(rdist.earth(t(as.matrix(storelatlon)), as.matrix(custlatlon),
miles=F) <= TAsize[i])
dist <-
as.data.frame(rdist.earth(t(as.matrix(storelatlon)),
as.matrix(custlatlon), miles=F)[whichval])
storetag <-
as.data.frame(cbind(1:nrow(dist),storelist[j,1]))
fincalc <-
as.da...
2004 Feb 26
1
Distance and Aggregate Data - Again...
I appreciate the help I've been given so far. The issue I face is
that the data I'm working with has 53000 rows, so in calculating
distance, finding all recids that fall within 2km and summing the
population, etc. - a) takes too long and b) have no sense of progress.
Below is a loop that reads each recid one at a time, calculates the
distance and identifies the recids that fall within 2