[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    Re: [Rd] data frame method for as.table()
From:       Ernest =?iso-8859-1?Q?Adrogu=E9?= <eac () openmailbox ! org>
Date:       2016-05-23 18:56:50
Message-ID: 20160523185650.GA5665 () doriath ! local
[Download RAW message or body]

Hi,

2016-05-23, 12:50 (-0500); Marc Schwartz escriu:
> Hi,
> 
> I have not tried an exhaustive set of examples, but I believe that ?xtabs
> will get you most of the way there, with the exception of NA handling,
> which would require either nuanced use of ?addNA or preprocessing factors
> in the input data frame to possibly add NA as a factor level where needed.
> 
> BTW, from ?as.data.frame.table, see the reference there to xtabs() at the
> end:
> 
> "The as.data.frame method for objects inheriting from class "table" can be
> used to convert the array-based representation of a contingency table to a
> data frame containing the classifying factors and the corresponding
> entries (the latter as component named by responseName). This is the
> inverse of xtabs."
> 
> 
> For example, from ?xtabs, using the ?UCBAdmissions dataset, which is a 3
> dimension table:
>
[...]

Thanks... I didn't know about xtabs and addNA.  I'll look into it, but at
first sight it seems that the functionality is pretty much already covered
by some combination of these two,.

Regards.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic