From paterno at fnal.gov  Fri Sep  4 04:45:12 2009
From: paterno at fnal.gov (paterno at fnal.gov)
Date: Fri,  4 Sep 2009 04:45:12 +0200 (CEST)
Subject: [Rd] Apparent bug in summaryBy (PR#13941)
Message-ID: <20090904024513.0B5F9282EF4F@mail.pubhealth.ku.dk>

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.
-------------------
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



[Rd] Apparent bug in summaryBy (PR#13941)
paterno at fnal.gov