[Rd] Apparent bug in summaryBy (PR#13941)
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Sep 4 12:25:51 CEST 2009
paterno at fnal.gov wrote:
> Full_Name: Marc Paterno
> Version: 2.9.2
> OS: Mac OS X 10.5.8
> Submission from: (NULL) (99.53.212.55)
>
>
> summaryBy() produces incorrect results when given some data frames. Below is a
> transcript of a session showing the result, in a data frame with 2 observations
> of 2 variables.
>
This looks like a bug in the doBy package (or something it uses), not a
bug in R. I've cc'd the maintainer of that package to let him know
about it.
By the way, an easier way to create that dataframe is simply
tmp <- data.frame(V1=c("c", "b"), V2=c(1,2))
Duncan Murdoch
> -------------------
> thomas:999 paterno$ R --vanilla
>
> R version 2.9.2 (2009-08-24)
> Copyright (C) 2009 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>
>> library(doBy)
>> tmp = read.table("moduledata_999_1.txt",header=FALSE)
>> str(tmp)
>>
> 'data.frame': 2 obs. of 2 variables:
> $ V1: Factor w/ 2 levels "b","c": 2 1
> $ V2: num 1 2
>
>> tmp
>>
> V1 V2
> 1 c 1
> 2 b 2
>
>> summaryBy(V2~V1,tmp)
>>
> V1 V2.mean
> 1 b 1
> 2 c 2
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list