Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-26 Thread David Winsemius
On Jun 25, 2015, at 11:52 PM, Steven Yen wrote: > Thanks Davis. But actually, the line is legitimate: I didn't say it was illegitimate, only confusing. > > if (inherits(wt,what="character")) wt<-data[,wt] What you are asking for is known in R as non-standard evaluation. Examples include th

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread Steven Yen
Thanks Davis. But actually, the line is legitimate: if (inherits(wt,what="character")) wt<-data[,wt] because, coming down with wt being characters, the part wt<-data[,wt] then picks up variables data$wt. The call wmean(mydata,wt="weight") actually goes OK. I was hoping to figure out a

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread David Winsemius
On Jun 25, 2015, at 7:48 PM, Steven Yen wrote: > Thanks to all for the help. I have learned much about "inherit" and "class". > I like to know about one additional option, and that is to use a calling > parameter without the quotation marks, similar to the linear regression > syntax: > > lm(d

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread Steven Yen
Thanks to all for the help. I have learned much about "inherit" and "class". I like to know about one additional option, and that is to use a calling parameter without the quotation marks, similar to the linear regression syntax: lm(data=mydata,weights=wt) Below is a simple set of codes to ca

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-24 Thread Martin Maechler
> Steve Taylor > on Wed, 24 Jun 2015 00:56:26 + writes: > Note that objects can have more than one class, in which case your == and %in% might not work as expected. > Better to use inherits(). > cheers, > Steve Yes indeed, as Steve said, really do! The use