From eac at openmailbox.org  Mon May 23 20:56:50 2016
From: eac at openmailbox.org (Ernest =?iso-8859-1?Q?Adrogu=E9?=)
Date: Mon, 23 May 2016 20:56:50 +0200
Subject: [Rd] data frame method for as.table()
In-Reply-To: <816CB725-C3E4-47B1-8E79-9C2AC03A5996@me.com>
References: <20160523164618.GA4876@doriath.local>
	<816CB725-C3E4-47B1-8E79-9C2AC03A5996@me.com>
Message-ID: <20160523185650.GA5665@doriath.local>

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.



[Rd] data frame method for as.table()
Ernest =?iso-8859-1?Q?Adrogu=E9?=