[R] Question On CrossTable function in gmodels package

eugen pircalabelu eugen_pircalabelu at yahoo.com
Thu Jan 29 15:01:37 CET 2009


Hi R-users,
I have the following problem with CrossTable function within “gmodels” package: the output of the function (format “spss” and asresid=T) can not be stored within another object.
For example:

>library(gmodels)
>data(infert, package = "datasets")
> CrossTable(infert$education, infert$induced)->aa # the function prints everything ok on the screen
> aa  # works just fine
$t
         y
x          0  1  2
  0-5yrs   4  2  6
  6-11yrs 78 27 15
  12+ yrs 61 39 16
…………….
But when I call
>CrossTable(infert$education, infert$induced, asresid=TRUE, format="SPSS")->aaa  # the function prints everything ok on the screen
> aaa  # now I have a problem 
NULL

Why is aaa object NULL? Should it be NULL? I suspect it has something to do with the SPSS-format option but I’m not sure 
The reason I want it stored in an object, is to use the adjusted standardized residuals in a LateX document with xtable. 
Does anyone have a solution, please?

Thank you very much and have a great day ahead!  


PS: 
sessionInfo()
R version 2.7.1 (2008-06-23) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gmodels_2.14.1 xtable_1.5-4  

loaded via a namespace (and not attached):
[1] gdata_2.3.1  gtools_2.4.0 MASS_7.2-42  tools_2.7.1








More information about the R-help mailing list