Dear R-devel, AsIs class seems to be well handled by `typeof` and `mode` function. Those two functions are being referred when explaining `is.vector` behaviour in manual. Yet `is.vector` does not seem to be handling AsIs class the same way. is.vector(1L) #[1] TRUE is.vector(I(1L)) #[1] FALSE Is there any reason behind this behaviour? Could we have it supported so AsIs class is ignored when `is.vector` is doing its job? Best Regards, Jan Gorecki
Jan, I believe it's because it has "a non-NULL attribute other than names" as per the documentation. In this case its class of "AsIs". Best, ~G On Sun, Mar 29, 2020 at 6:29 AM Jan Gorecki <j.gorecki at wit.edu.pl> wrote:> Dear R-devel, > > AsIs class seems to be well handled by `typeof` and `mode` function. > Those two functions are being referred when explaining `is.vector` > behaviour in manual. Yet `is.vector` does not seem to be handling AsIs > class the same way. > > is.vector(1L) > #[1] TRUE > is.vector(I(1L)) > #[1] FALSE > > Is there any reason behind this behaviour? > Could we have it supported so AsIs class is ignored when `is.vector` > is doing its job? > > Best Regards, > Jan Gorecki > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
Thank you Gabriel, Agree, although I think that could be relaxed in this single case and AsIs class could be ignored. Best, Jan On Sun, Mar 29, 2020 at 7:09 PM Gabriel Becker <gabembecker at gmail.com> wrote:> > Jan, > > I believe it's because it has "a non-NULL attribute other than names" as per the documentation. In this case its class of "AsIs". > > Best, > ~G > > On Sun, Mar 29, 2020 at 6:29 AM Jan Gorecki <j.gorecki at wit.edu.pl> wrote: >> >> Dear R-devel, >> >> AsIs class seems to be well handled by `typeof` and `mode` function. >> Those two functions are being referred when explaining `is.vector` >> behaviour in manual. Yet `is.vector` does not seem to be handling AsIs >> class the same way. >> >> is.vector(1L) >> #[1] TRUE >> is.vector(I(1L)) >> #[1] FALSE >> >> Is there any reason behind this behaviour? >> Could we have it supported so AsIs class is ignored when `is.vector` >> is doing its job? >> >> Best Regards, >> Jan Gorecki >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel