Subject: Re: [R] Selecting single TAZ based on area proportion
try this
t - TazProperties..
v - aggregate(t$Area, by=list(t$TAZ,t$Props), sum)
names(v) - c(TAZ, Prop, area)
tapply(v$area, v$Prop, function(x) v$TAZ[which.max(x)])
note that you have to deal with the cases where there is a tie
Good day all,
I am having an issue coercing my data. Below i have some data on taxlots
and an associated TAZ(transportation analsysi zone) that each property is
within. The main issue is that some properties cross TAZ boundaries so i
need to make a decision as to which TAZ the property
try this
t - TazProperties..
v - aggregate(t$Area, by=list(t$TAZ,t$Props), sum)
names(v) - c(TAZ, Prop, area)
tapply(v$area, v$Prop, function(x) v$TAZ[which.max(x)])
note that you have to deal with the cases where there is a tie for the
maximum. The above just returns the first maximum.
3 matches
Mail list logo