is.vector could handle AsIs class better

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

is.vector could handle AsIs class better

Jan Gorecki
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: is.vector could handle AsIs class better

Gabriel Becker-2
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 <[hidden email]> 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
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: is.vector could handle AsIs class better

Jan Gorecki
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 <[hidden email]> 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 <[hidden email]> 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
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: is.vector could handle AsIs class better

R devel mailing list
The use of the term 'vector' in R comes from S, where it was used, starting
in the latter part of the 1970s, to refer to the most primitive
(irreducible) parts of an object.  It has little to do with the
mathematical or physical concept of a vector and, in my opinion, should not
be used much by ordinary users.  In hindsight, it may have been better to
use some Joycean neologism instead of the word vector so people would not
have any notions of what it should do.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Mar 30, 2020 at 2:26 AM Jan Gorecki <[hidden email]> wrote:

> 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 <[hidden email]>
> 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 <[hidden email]>
> 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
> >>
> >> ______________________________________________
> >> [hidden email] mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel