Re: [R] Reshape with var as fun.aggregate

2008-11-27 Thread locklin . jason
Thanks, that works fine.
___
Regards,
Jason Locklin, B.Sc. Hons.
University of Waterloo
http://artsweb.uwaterloo.ca/~jalockli


On Wednesday 26 November 2008 19:49:48 you wrote:
 Hi Jason,

 The reason you are getting this error is that the latest version of
 reshape uses fun.aggregate(numeric(0)) to figure out what missing
 values should be filled in with.  Unfortunately there was a brief
 period in R versions when var(numeric(0)) returned an error rather
 than a missing value.  You can work around the problem by manually
 specifying fill = NA.

 Regards,

 Hadley

 On Wed, Nov 26, 2008 at 1:05 PM,  [EMAIL PROTECTED] wrote:
  I used to be able to use variance for fun.aggregate, but since I
  upgraded from R 2.6 to 2.7 (Ubuntu hardy to intrepid), it no
  longer works.
 
  library(reshape)
  data(french_fries)
  ffm - melt(french_fries, id=1:4, na.rm = TRUE)
  cast(ffm, rep ~ treatment, length)
 
   rep   1   2   3
  1   1 579 578 575
  2   2 580 579 580
 
  cast(ffm, rep ~ treatment, mean)
 
   rep123
  1   1 3.207772 3.177336 3.024522
  2   2 3.181207 3.115544 3.277759
 
  cast(ffm, rep ~ treatment, var)
 
  Error in fun.aggregate(data$value[0]) : 'x' is empty
 
  Any ideas?
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html and provide
  commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reshape with var as fun.aggregate

2008-11-26 Thread locklin . jason
I used to be able to use variance for fun.aggregate, but since I 
upgraded from R 2.6 to 2.7 (Ubuntu hardy to intrepid), it no longer 
works.

 library(reshape)
 data(french_fries)
 ffm - melt(french_fries, id=1:4, na.rm = TRUE)
 cast(ffm, rep ~ treatment, length)
  rep   1   2   3
1   1 579 578 575
2   2 580 579 580
 cast(ffm, rep ~ treatment, mean)
  rep123
1   1 3.207772 3.177336 3.024522
2   2 3.181207 3.115544 3.277759
 cast(ffm, rep ~ treatment, var)
Error in fun.aggregate(data$value[0]) : 'x' is empty

Any ideas?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reshape with var as fun.aggregate

2008-11-26 Thread hadley wickham
Hi Jason,

The reason you are getting this error is that the latest version of
reshape uses fun.aggregate(numeric(0)) to figure out what missing
values should be filled in with.  Unfortunately there was a brief
period in R versions when var(numeric(0)) returned an error rather
than a missing value.  You can work around the problem by manually
specifying fill = NA.

Regards,

Hadley

On Wed, Nov 26, 2008 at 1:05 PM,  [EMAIL PROTECTED] wrote:
 I used to be able to use variance for fun.aggregate, but since I
 upgraded from R 2.6 to 2.7 (Ubuntu hardy to intrepid), it no longer
 works.

 library(reshape)
 data(french_fries)
 ffm - melt(french_fries, id=1:4, na.rm = TRUE)
 cast(ffm, rep ~ treatment, length)
  rep   1   2   3
 1   1 579 578 575
 2   2 580 579 580
 cast(ffm, rep ~ treatment, mean)
  rep123
 1   1 3.207772 3.177336 3.024522
 2   2 3.181207 3.115544 3.277759
 cast(ffm, rep ~ treatment, var)
 Error in fun.aggregate(data$value[0]) : 'x' is empty

 Any ideas?

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.