On Thu, Aug 20, 2009 at 10:49 PM, Peng Yu <pengyu.ut@gmail.com> wrote:

> Hi,
>
> Please see the code below this message. 'a' is a vector, 'b' is a
> scalar. But their types are show the same ('numeric'). If I use
> 'class()', I will not be able to tell the type difference between a
> vector and a scalar. I am wondering if there is any other command that
> can tell the type difference between a vector and a scalar.
>
> Regards,
> Peng
>
> > a=c(1,2,3)
> > class(a)
> [1] "numeric"
> > b=2
> > class(b)
> [1] "numeric"
>

Both are vectors.  "b" is simply a vector of length 1.

See ?vector and ?length.

Sean

	[[alternative HTML version deleted]]

