Hi, I am using the CrossTable function from library(gmodels). x=unique(data[,c("L1","L1_Revenues","RIC")]) L1_Classification=CrossTable(x$L1,x$L1_Revenues,exclude c("NA","","0%","0"),prop.r=FALSE,prop.c=FALSE,prop.t=FALSE,prop.chisq=FA LSE,dnn=c("L1_Classification","Revenue")) What I would like to do is to get the out put in excel. Also I do not want the output displayed on the console. Is there some way of doing this? 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 xlsReadWrite_1.3.2 loaded via a namespace (and not attached): [1] gdata_2.4.2 gtools_2.5.0 MASS_7.2-42 Thank you, Ravi This e-mail may contain confidential and/or privileged i...{{dropped:13}}
Ravi S. Shankar <ravis <at> ambaresearch.com> writes:> > I am using the CrossTable function from library(gmodels). > > x=unique(data[,c("L1","L1_Revenues","RIC")]) > > L1_Classification=CrossTable(x$L1,x$L1_Revenues,exclude > c("NA","","0%","0"),prop.r=FALSE,prop.c=FALSE,prop.t=FALSE,prop.chisq=FA > LSE,dnn=c("L1_Classification","Revenue")) > > What I would like to do is to get the out put in excel. Also I do not > want the output displayed on the console. Is there some way of doing > this?gmodels' CrossTable is not very flexible for this, because it has hard-wired cat producing the output. Try to massage ftable: ft = ftable(mtcars$cyl, mtcars$vs, mtcars$am, mtcars$gear) write.csv(ft, file = "ft.csv") # see docs how to Also check package Hmisc and reshape (the latter is not very flexible for categorical data, but good for numeric). Dieter