[R] Cross tabulation with top one variable and side as multiple variables

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Jun 9 20:39:57 CEST 2015


There are two issues here... calculation and presentation. The table function from base R can work with many variables. If your data set is so large that you have problems with memory then you could investigate data.table or sqldf packages, which perform the computations but do not present the data in cross tabulation form. You could use table or perhaps the tables package to render the data into the desired form.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at 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.

On June 9, 2015 1:40:53 AM PDT, jagadishpchary <p.jagadish at inrhythm-inc.com> wrote:
>Hi:
>
>I have a huge data with lot of variables and I need to check the trend
>variations from year to year. In order to do so, I have to cross
>tabulate
>the year variable as top (constant) and all the remaining variables as
>side
>(attached the cross tabulation report). I have searched the forums but
>the
>syntax I could find for cross tabulation is between 2 or 3 variables.
>So i
>would request to provide a code which can print the data in the same
>way as
>in the attached. 
><http://r.789695.n4.nabble.com/file/n4708379/Untitled.png> 
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Cross-tabulation-with-top-one-variable-and-side-as-multiple-variables-tp4708379.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list