Re: [Rd] as.missing

2006-10-27 Thread Peter Dalgaard
Luke Tierney <[EMAIL PROTECTED]> writes: > There are lot of subtle issues involved here. We should think through > carefuly exactly what semantics we want for missing value propagation > before making any changes. Making usage easy at top level is > genearlly a good thing, but for usage within fu

Re: [Rd] as.missing

2006-10-27 Thread Luke Tierney
There are lot of subtle issues involved here. We should think through carefuly exactly what semantics we want for missing value propagation before making any changes. Making usage easy at top level is genearlly a good thing, but for usage within functions eliminating error messages by making more

Re: [Rd] as.missing

2006-10-27 Thread Gabor Grothendieck
On 10/26/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > This is what I get: > > > as.missing <- force > > f <- function(y, x=1) {cat(missing(x)) ; x} > > g <- function(x=as.missing()) f(3,x) > > g() > FALSEError in as.missing() : argument "x" is missing, with no default > > traceback() > 3: as

Re: [Rd] as.missing

2006-10-27 Thread Paul Gilbert
Peter Dalgaard wrote: >Paul Gilbert <[EMAIL PROTECTED]> writes: > > > >>Peter Dalgaard wrote: >> >> >> >>>Paul Gilbert <[EMAIL PROTECTED]> writes: >>> >>> >>> >>> >I.e., when x is missing in g, and g calls f(3,x), f will use its >default value for x. > > >>>

Re: [Rd] as.missing

2006-10-27 Thread Peter Dalgaard
Paul Gilbert <[EMAIL PROTECTED]> writes: > Peter Dalgaard wrote: > > >Paul Gilbert <[EMAIL PROTECTED]> writes: > > > > > >>>I.e., when x is missing in g, and g calls f(3,x), f will use its > >>>default value for x. > >>> > >> Yes, that is the behaviour I am looking for. That is, f should do > >>

Re: [Rd] as.missing

2006-10-27 Thread Paul Gilbert
Duncan Murdoch wrote: > On 10/27/2006 10:24 AM, Peter Dalgaard wrote: > >> Paul Gilbert <[EMAIL PROTECTED]> writes: >> >>> >I.e., when x is missing in g, and g calls f(3,x), f will use its >>> >default value for x. >>> > > >>> Yes, that is the behaviour I am looking for. That is, f should do

Re: [Rd] as.missing

2006-10-27 Thread Paul Gilbert
Peter Dalgaard wrote: >Paul Gilbert <[EMAIL PROTECTED]> writes: > > > >>>I.e., when x is missing in g, and g calls f(3,x), f will use its >>>default value for x. >>> >>> >>> >>> >>Yes, that is the behaviour I am looking for. That is, f should do what >>it normal would do if it were ca

Re: [Rd] as.missing

2006-10-27 Thread Duncan Murdoch
On 10/27/2006 10:24 AM, Peter Dalgaard wrote: > Paul Gilbert <[EMAIL PROTECTED]> writes: > >> >I.e., when x is missing in g, and g calls f(3,x), f will use its >> >default value for x. >> > >> > >> Yes, that is the behaviour I am looking for. That is, f should do what >> it normal would do if

Re: [Rd] as.missing

2006-10-27 Thread Peter Dalgaard
Paul Gilbert <[EMAIL PROTECTED]> writes: > >I.e., when x is missing in g, and g calls f(3,x), f will use its > >default value for x. > > > > > Yes, that is the behaviour I am looking for. That is, f should do what > it normal would do if it were called with x missing. But if x has a default i

Re: [Rd] as.missing

2006-10-27 Thread Paul Gilbert
Bjørn-Helge Mevik wrote: >Gabor Grothendieck wrote: > > > >>This is what I get: >> >> >> >>>as.missing <- force >>>f <- function(y, x=1) {cat(missing(x)) ; x} >>>g <- function(x=as.missing()) f(3,x) >>>g() >>> >>> >>FALSEError in as.missing() : argument "x" is missing, with no defaul

Re: [Rd] as.missing

2006-10-27 Thread Bjørn-Helge Mevik
Gabor Grothendieck wrote: > This is what I get: > >> as.missing <- force >> f <- function(y, x=1) {cat(missing(x)) ; x} >> g <- function(x=as.missing()) f(3,x) >> g() > FALSEError in as.missing() : argument "x" is missing, with no default >> traceback() > 3: as.missing() > 2: f(3, x) > 1: g() >> t

Re: [Rd] as.missing

2006-10-26 Thread Gabor Grothendieck
This is what I get: > as.missing <- force > f <- function(y, x=1) {cat(missing(x)) ; x} > g <- function(x=as.missing()) f(3,x) > g() FALSEError in as.missing() : argument "x" is missing, with no default > traceback() 3: as.missing() 2: f(3, x) 1: g() > traceback() 3: as.missing() 2: f(3, x) 1: g()

Re: [Rd] as.missing

2006-10-26 Thread Paul Gilbert
I don't see how this solves the problem. > as.missing <- force > f <- function(y, x=1) {cat(missing(x)) ; x} > g <- function(x) f(3,x) > g(1) FALSE[1] 1 > g() TRUEError in f(3, x) : argument "x" is missing, with no default I think I still have to put all the logic in g() to figure out if th

Re: [Rd] as.missing

2006-10-25 Thread Gabor Grothendieck
You can do it like this: > as.missing <- force > g <- function(x = as.missing()) missing(x) > g(3) [1] FALSE > g() [1] TRUE On 10/24/06, Paul Gilbert <[EMAIL PROTECTED]> wrote: > (I'm not sure if this is a request for a feature, or another instance > where a feature has eluded me for many years.)

Re: [Rd] as.missing

2006-10-25 Thread Paul Gilbert
Peter Dalgaard wrote: >"Charles C. Berry" <[EMAIL PROTECTED]> writes: > > > >>On Tue, 24 Oct 2006, Duncan Murdoch wrote: >> >> > > > >>>with no defaults. However, this little demo illustrates the point, I think: >>> >>> >>> g <- function(gnodef, gdef=1) { >>>

Re: [Rd] as.missing

2006-10-24 Thread Peter Dalgaard
"Charles C. Berry" <[EMAIL PROTECTED]> writes: > On Tue, 24 Oct 2006, Duncan Murdoch wrote: > > with no defaults. However, this little demo illustrates the point, I think: > > > > > g <- function(gnodef, gdef=1) { > > +if (missing(gnodef)) cat('gnodef is missing\n') > > +if (missing(gdef

Re: [Rd] as.missing

2006-10-24 Thread Charles C. Berry
On Tue, 24 Oct 2006, Duncan Murdoch wrote: > On 10/24/2006 12:58 PM, Paul Gilbert wrote: >> (I'm not sure if this is a request for a feature, or another instance >> where a feature has eluded me for many years.) >> >> Often I have a function which calls other functions, and may often use >> the de

Re: [Rd] as.missing

2006-10-24 Thread Duncan Murdoch
On 10/24/2006 12:58 PM, Paul Gilbert wrote: > (I'm not sure if this is a request for a feature, or another instance > where a feature has eluded me for many years.) > > Often I have a function which calls other functions, and may often use > the default arguments to those functions, but needs th

[Rd] as.missing

2006-10-24 Thread Paul Gilbert
(I'm not sure if this is a request for a feature, or another instance where a feature has eluded me for many years.) Often I have a function which calls other functions, and may often use the default arguments to those functions, but needs the capability to pass along non-default choices. I usu