I have a dataframe from an On-Board Survey with weights ("expwgt") and variables for up to 8 used lines: VEH1 through VEH8. The lines are labeled "MT-..1" through "MT-902". I want to know how many transfers there are between MT-802 and MT-901.  That is, when one of them is VEHx and the other is VEHx+1 or VEHx-1

E.g. {VEH1 = MT-802 AND VEH2 = MT-901 } plus {VEH2 = MT-901 AND VEH3 = MT-802} plus all the other combinations....


Someone suggested:

colvf <- 81 # column of first VEH in indat
colvl <- 88 # column of last  VEH in indat
tapply( rep( SubOre$expwgt, colvl-colvf ),
        list( as.matrix(SubOre[ ,colvf:(colvl-1)]),
              as.matrix(SubOre[ ,(colvf+1):colvl]) ),  sum)

but there are too many rows and columns to print.




Robert Farley
LACMTA
1 Gateway Plaza
Los Angeles, CA 90012-2952
(213)922-2532
FarleyR@Metro.net


	[[alternative HTML version deleted]]

