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? More simply: Are scalars really trivial vectors? Thanks. -chris
On Mon, 7 Apr 2003, Chris Fehily wrote:> 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?Yes. c() is a function which here is doing nothing useful.> More simply: Are scalars really trivial vectors?Thare are no scalar variables in S. Since there are vectors of length zero, those of length one are not `really trivial' in comparison. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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
Yes, scalars are really trivial vectors. On Mon, 7 Apr 2003, Chris Fehily wrote:> 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? > > More simply: Are scalars really trivial vectors? > > Thanks. > -chris >
Possibly Parallel Threads
- how much performance penalty does this incur, scalar as a vector of one element?
- [LLVMdev] Scalar replacement of arrays
- [LLVMdev] Scalar replacement of arrays
- Concern: rsync failing to find some attributes in a file transfer?
- One element vectors versus scalars