[R] use of the 'by' command & converting SPSS ANOVA/GLM syntax into R syntax

Bob Green bgreen at dyson.brisnet.org.au
Sun Nov 20 21:44:21 CET 2005


I have two questions I would appreciate assistance with:

(1)  I believe "by" is the command used to split a file. In the following 
example, "mydat" is the dataframe , "group" the variable I want to split 
the analysis by & "WK1FREQ,WK2FREQ" the variables

attach(mydat)
by (GROUP)
cor.test (WK1FREQ,WK2FREQ)

I have also tried: (by (GROUP) cor.test (WK1FREQ,WK2FREQ))

(2)

I also wanted to run the following analyses, written in SPSS syntax. I have 
searched the R archives and gather I may need to use lm instead of glm, but 
got lost.

UNIANOVA
avfreq BY sex  WITH blik
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/EMMEANS = TABLES(OVERALL)
/EMMEANS = TABLES(sex)
/PRINT = DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA = ALPHA(.05)
/DESIGN = blik sex blik*sex .

  GLM
    avmth3fq avfreq BY SEX
   /WSFACTOR = timex 2 Polynomial
   /METHOD = SSTYPE (3)
   /PRINT = DESCRIPTIVE ETASQ TEST(MMATRIX) HOMOGENEITY
   /CRITERIA = ALPHA (.05)
   /WSDESIGN = timex
   /DESIGN = sex .

Any assistance with either of these enquiries is most appreciated.

Bob




More information about the R-help mailing list