[R] Scalar vs. vector

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Apr 8 14:29:42 CEST 2003


Chris Fehily <fehily at pacbell.net> writes:

> Do these statements yield identical types of objects?
>    x = 3
> and
>    y = c(3)
> 
> That is, intrinsically, is x, like y, a vector of length one, but
> created with abbreviated syntax?

No, y is like x, a vector of length one, only created with an overly
long-winded syntax... 

(c() is for *concatenation*)

> More simply: Are scalars really trivial vectors?

Yes.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-help mailing list