If t(table(OBJECT)) does not work, does:
u<-as.matrix(table(OBJ))
t(u)

-i.e. use matrix operations?




On Sun, Oct 6, 2013 at 1:47 PM, LAMONT, ANDREA <lamo...@mailbox.sc.edu>wrote:

>
>
>
> ________________________________________
> From: r-help-bounces@r-project.orgOn Behalf OfBerend Hasselman
> Sent: Sunday, October 06, 2013 1:44:30 PM (UTC-05:00) Eastern Time (US &
> Canada)
> To: Dennis Fisher
> Cc: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Transposing the output of 'table'
>
> On 06-10-2013, at 19:30, Dennis Fisher <fis...@plessthan.com> wrote:
>
> > R 3.0.1
> > OS X
> >
> > Colleagues,
> >
> > If I execute the command:
> >       table(OBJECT)
> > the output might look like:
> >  1   2
> > 25 336
> >
> > I would like it to appear as:
> >       1       25
> >       2       336
> >
> > I can accomplish this with:
> >       TABLE   <- table(OBJECT)
> >       data.frame(names(TABLE), as.numeric(TABLE))
> >
> > However, I bet that a more clever approach exists?  Any takers?
>
>
> Have you tried t(table(OBJECT)) ?
>
> Berend
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
>



-- 
Andrea Lamont, MA
Clinical-Community Psychology
University of South Carolina
Barnwell College
Columbia, SC 29208

Please consider the environment before printing this email.

CONFIDENTIAL: This transmission is intended for the use of the
individual(s) or entity to which it is addressed, and may contain
information that is privileged, confidential, and exempt from disclosure
under applicable law. Should the reader of this message not be the intended
recipient(s), you are hereby notified that any dissemination, distribution,
or copying of this communication is strictly prohibited.  If you are not
the intended recipient, please contact the sender by reply email and
destroy/delete all copies of the original message.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to