[R] Problem with subset() function?

2009-01-20 Thread Steven McKinney
Hi all, Can anyone explain why the following use of the subset() function produces a different outcome than the use of the [ extractor? The subset() function as used in density(subset(mydf, ht = 150.0 wt = 150.0, select = c(age))) appears to me from documentation to be equivalent to

Re: [R] Problem with subset() function?

2009-01-20 Thread Andrew Robinson
Steven, check the class of the objects that you are creating. Cheers, Andrew On Wed, January 21, 2009 10:02 am, Steven McKinney wrote: Hi all, Can anyone explain why the following use of the subset() function produces a different outcome than the use of the [ extractor? The subset()

Re: [R] Problem with subset() function?

2009-01-20 Thread Marc Schwartz
on 01/20/2009 05:02 PM Steven McKinney wrote: Hi all, Can anyone explain why the following use of the subset() function produces a different outcome than the use of the [ extractor? The subset() function as used in density(subset(mydf, ht = 150.0 wt = 150.0, select = c(age))) Here

Re: [R] Problem with subset() function?

2009-01-20 Thread David Winsemius
Consider an alternative and realize that it is density() that is complaining about being passed a dataframe rather than subset misbehaving: density(subset(mydf, ht = 150.0 wt = 150.0)$age) Call: density.default(x = subset(mydf, ht = 150 wt = 150)$age) Data: subset(mydf, ht = 150

Re: [R] Problem with subset() function?

2009-01-20 Thread Steven McKinney
, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: Marc Schwartz [mailto:marc_schwa...@comcast.net] Sent: Tue 1/20/2009 3:20 PM To: Steven McKinney Cc: R-help@r-project.org Subject: Re: [R] Problem with subset() function? on 01/20/2009 05:02 PM Steven McKinney wrote: Hi all