Hi,
I wonder if the following (apparent) inconsistency is a bug or feature.
Since scalars are simply vectors of length one I would think that
a and
a:a
produce the same result. For example,
> identical(4.01,4.01:4.01)
[1] TRUE
However,
identical(4,4:4)
[1] FALSE
and
> identical(4.0,4.0:4.0)
[1] FALSE
A closer look reveals that the colon operator produces objects of different class, e.g.
> class(4)
[1] "numeric"
> class(4.0)
[1] "numeric"
but
> class(4:4)
[1] "integer"
> class(4.0:4.0)
[1] "integer"
Georgi Boshnakov
------------------------------------------------------------------------------
Dr Georgi Boshnakov tel.: +44 (0)161 200 3684
Mathematics Department email: [EMAIL PROTECTED]
UMIST
P O Box 88
Manchester M60 1QD
UK
[[alternative HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html