From vdergachev at rcgardis.com  Wed Mar 26 17:23:56 2008
From: vdergachev at rcgardis.com (Vladimir Dergachev)
Date: Wed, 26 Mar 2008 12:23:56 -0400
Subject: [Rd] S4 slot with NA default
In-Reply-To: <00025495-F390-4A46-885E-5FAD2B4B66A7@noc.soton.ac.uk>
References: <00025495-F390-4A46-885E-5FAD2B4B66A7@noc.soton.ac.uk>
Message-ID: <200803261223.56963.vdergachev@rcgardis.com>

On Wednesday 26 March 2008 12:04:11 pm Robin Hankin wrote:
> Hi
>
> How do I specify an S4 class with a slot that is potentially numeric,
> but NA
> by default?  I   want the slot to be NA until I calculate its value
>   (an expensive operation, not needed for all applications).   When
> its value is
> known, I  will create a new object with the correct value inserted in
> the slot.
>
> I want "NA" to signify "not known".
>
> My attempt fails because NA is not numeric:
>

Try as.numeric(NA) - by default, plain NA is of type "logical"

                  best

                    Vladimir Dergachev

>
>
>
> --
> Robin Hankin
> Uncertainty Analyst and Neutral Theorist,
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Vladimir Dergachev            RCG Ardis Capital LLC



[Rd] S4 slot with NA default
Vladimir Dergachev