I agree that the documentation should be clarified. Moreover, my last example 
shows that the class can be different even when no mode coercion is required. I 
don't know enough about S3 & S4 to comment on your last point.

Regards,
Jorgen Harmse.


From: Bert Gunter <bgunter.4...@gmail.com>
Date: Monday, 24October, 2022 at 11:31
To: Jorgen Harmse <jhar...@roku.com>
Cc: r-help@r-project.org <r-help@r-project.org>
Subject: [EXTERNAL] Re: [R] unexpected 'else' in " else" (Ebert,Timothy Aaron)
...

So it would appear that the ifelse() documentation needs to be
clarified. For example, if the above asterisked phrase were "The S3
*class* of the answer will be inferred from the mode, where the mode
of the answer will be coerced ..." that might resolve at least that
bit of confusion However, that might also be incorrect -- what about
S4 vs S3 vs Reference classes, for example (are such cases even
possible?)? I leave resolution of these matters -- or at least their
accurate and complete documentation -- to wiser heads.

Cheers,
Bert

...

> > ifelse(integer(0L)) # test is an empty vector of integers and yes & no are 
> > missing.
>
> logical(0)


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to