[R] Custom Numeric type in R
gunter.berton at gene.com
Sun Nov 10 22:07:40 CET 2013
That was my initial thought, too. But then I wondered whether what was
meant was to use "TBD" as an alternative kind of numeric value that
would be part of numeric vectors, lists, etc. in the same way that NA
or Inf is. It is not clear to me that a new object class provides a
way to do this, at least not without a large amount of recreating
standard R objects and the operations on them to include a "TBD" type
numeric. My understanding is that NA and Inf are built into R's
internals as part of IEEE floating point standards. I do not know how
or if one can add new numeric types to these.
I would appreciate correction of any misunderstanding that I have and
further details as to how one would do this.
On Sun, Nov 10, 2013 at 9:49 AM, Charles Berry <ccberry at ucsd.edu> wrote:
> Christofer Bogaso <bogaso.christofer <at> gmail.com> writes:
>> Hi again,
>> In R, there are various numerics like, NA, Inf, or simple integers etc.
>> However I want to include one custom type: "TBD", which R should treat as
>> numeric, not character.
>> That "TBD" should have same property like Inf, however except this: TBD -
>> TBD = 0
>> In future, I am planning to add few more properties to TBD.
>> Can somebody guide me if this is possible in R, ans also some pointer on
>> how can be done in R
> Possible? Yes.
> Your question might be framed as
> "How do I create a class and write a method for '-' that does ... ?"
> The answer is "learn about methods and classes in R".
> To get started, see
> and follow the links therein.
> Check the posting guide. If you need to follow up, you should consider
> whether the question you have fits better on R-devel.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Genentech Nonclinical Biostatistics
More information about the R-help