It's useful when you need to be certain of the mode of a vector. One such
situation is when you are about to call a C-language function using the
.C() interface. As you point out, some assignments (even just to vector
elements) can change the mode of the entire vector. This is why it's
impor
Joel Bremson <[EMAIL PROTECTED]> writes:
> Hi all,
>
> If I write
>
> v = vector(mode="numeric",length=10)
>
> I'm still allowed to assign non-numerics to v.
Not without changing the mode of v or the right hand side:
> v = vector(mode="numeric",length=10)
> v[3] <- T
> v
[1] 0 0 1 0 0 0 0 0
Hi all,
If I write
v = vector(mode="numeric",length=10)
I'm still allowed to assign non-numerics to v.
Furthermore, R figures out what kind of vector I've got anyway
when I use the mode() function.
So what is it that assigning a mode does?
Joel
__