how about this: tapply(vector,list(factor1,factor2),function)? -----Original Message----- From: owner-r-help at stat.math.ethz.ch [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Murray Jorgensen Sent: 24. september 2000 02:46 To: R-help Subject: [R] Crosstabulation I can't seem to find a function in R similar to Splus crosstabs() for creating a multi-way table from factors and a count vector. Murray Jorgensen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 09:16 PM 24-09-00 +0200, =?us-ascii?Q?Jacob_Anhoj?= wrote:>how about this: tapply(vector,list(factor1,factor2),function)?Thank you, Jacob. I've tried it out on this example on housing satisfaction in Copenhagen taken from Annette Dobson's book on GLMs. It works fine! count <- scan() 65 130 67 54 76 48 100 111 62 34 141 130 47 116 105 100 191 104 s <- c("Lo", "Med", "Hi") satisfaction <- factor( rep(c(s,s), rep(3,6)), levels = c("Lo","Med","Hi")) contact <- factor( rep(c("Low","High"), rep(9,2)), levels = c("Low","High")) r <- c("Tower", "Flat", "House") residence <- factor(rep(r,6)) tapply(count,list(satisfaction,contact,residence),sum)>-----Original Message----- >From: owner-r-help at stat.math.ethz.ch >[mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Murray Jorgensen >Sent: 24. september 2000 02:46 >To: R-help >Subject: [R] Crosstabulation > > >I can't seem to find a function in R similar to Splus crosstabs() for >creating a multi-way table from factors and a count vector. > > >Murray JorgensenDr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand *Applications Editor, Australian and New Zealand Journal of Statistics* maj at waikato.ac.nz Phone +64-7 838 4773 home phone 856 6705 Fax 838 4155 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear list, I can't seem to be able to load the MASS library into my R session (Windows 98; Pentium 133): R : Copyright 2000, The R Development Core Team Version 1.0.1 (April 14, 2000) [...]> library(MASS)Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library "D:\PROGRA~1\RW1001/library/MASS/libs/MASS.dll": LoadLibrary failure Those mixed \s and /s look bit funny. Ideas anyone? Murray Jorgensen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._