Then save to a variable, and maybe then to a file? Are you wanting it in long form? You can use reshape if so.
Note that a reproducible example and sample result always helps prompt more specific answers. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. "Farley, Robert" <farl...@metro.net> wrote: >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 >farl...@metro.net > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.