[R] nice report generator?

Tal Galili tal.galili at gmail.com
Sat Dec 10 14:22:31 CET 2011


Hello again Duncan,
I am sorry it took me two days to get back to your response.

Regarding reshape -
It is well presented here: http://www.jstatsoft.org/v21/i12
And there is also more information about it here: http://had.co.nz/reshape/

After playing around with it, I wrote a small "bridge" between {reshape}
and {tables} in a function called "tabular.cast_df".  I am attaching the
code (with self contained examples) to this e-mail.

I would be happy for any revisions from either you or anyone else on the
list.

While working on this, I found something which might be a bug in {tables}
(either in the way I am using the function, or in the way that it works),
please see example bellow:




# loading libraries
library(tables)
library(reshape)

# getting our data ready
names(airquality) <- tolower(names(airquality))
airquality2 <- airquality
airquality2$temp2 <- ifelse(airquality2$temp > median(airquality2$temp),
"hot", "cold")
aqm <- melt(airquality2, id=c("month", "day","temp2"), na.rm=TRUE)
colnames(aqm)[4] <- "variable2" # because otherwise the function is having
problem when relying on the melt function of the cast object
head(aqm,4)
  # month day temp2 variable2 value
# 1     5   1  cold     ozone    41
# 2     5   2  cold     ozone    36
# 3     5   3  cold     ozone    12

# possible BUG ?!
tabular(month*temp2~variable2*result_variable, data = m_xx)
# this one gets the "temp2" header in the first 2 columns (instead of in
only the second column).





----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili at gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Fri, Dec 9, 2011 at 1:51 AM, Duncan Murdoch <murdoch.duncan at gmail.com>wrote:

> On 11-12-08 1:37 PM, Tal Galili wrote:
>
>> Helloe dear Duncan, Gabor, Michael and others,
>>
>> Do you think it could be (reasonably) possible to create a bridge between
>> a
>> "cast_df" object from the {reshape} package into a table in Duncan's new
>> {tables} package?
>>
>
> I'm not that familiar with the reshape package (and neither it nor
> reshape2 appears to have a vignette to give me an overview), so I don't
> have any idea if that makes sense.  The table package is made to work on
> dataframes, and only dataframes.  It converts them into matrices with lots
> of attributes, so that the print methods can put nice labels on. But it's
> strictly rectangular to rectangular in the kinds of conversions it does,
> and from the little I know about reshape, it works on more general arrays,
> converting them to and from dataframes.
>
>
>
>
>> That would allow one to do pivot-table like operations on an object using
>> {reshape}, and then display it (as it would have been in excel - or
>> better)
>> using the {tables} package.
>>
>
> You'll have to give an example of what you want to do.
>
> Duncan Murdoch
>
>
>
>>
>>
>>
>>
>>
>> ----------------Contact
>> Details:----------------------**------------------------------**---
>> Contact me: Tal.Galili at gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>> ------------------------------**------------------------------**
>> ------------------------------**----
>>
>>
>>
>>
>> On Thu, Dec 8, 2011 at 5:24 PM, Michael<comtech.usa at gmail.com>  wrote:
>>
>>  Hi folks,
>>>
>>> In addition to Excel style tables, it would be great to have Excel 2010
>>> Pivot Table in R...
>>>
>>> Any thoughts?
>>>
>>> Thanks a lot!
>>>
>>> On Thu, Dec 8, 2011 at 4:49 AM, Tal Galili<tal.galili at gmail.com>  wrote:
>>>
>>>  I think it would be *great *if an extension of Duncan's new "tables"
>>>>
>>>> package could include themes and switches as are seen in the video Gabor
>>>> just linked to.
>>>>
>>>>
>>>> Tal
>>>>
>>>>
>>>>  On Thu, Dec 8, 2011 at 6:58 AM, Gabor Grothendieck<
>>>> ggrothendieck at gmail.com>  wrote:
>>>>
>>>>   On Wed, Dec 7, 2011 at 11:42 PM, Michael<comtech.usa at gmail.com>
>>>>>  wrote:
>>>>>
>>>>>> Do you have an example...? Thanks a lot!
>>>>>>
>>>>>
>>>>> See this video:
>>>>> http://www.woopid.com/video/**1388/Format-as-Table<http://www.woopid.com/video/1388/Format-as-Table>
>>>>>
>>>>> --
>>>>> Statistics&  Software Consulting
>>>>>
>>>>> GKX Group, GKX Associates Inc.
>>>>> tel: 1-877-GKX-GROUP
>>>>> email: ggrothendieck at gmail.com
>>>>>
>>>>> ______________________________**________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>>> <http://www.**r-project.org/posting-guide.**html<http://www.r-project.org/posting-guide.html>
>>>>> >
>>>>>
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>        [[alternative HTML version deleted]]
>>
>>
>> ______________________________**________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>


More information about the R-help mailing list