RE: [R] FW: why is it numeric(0)?

From: Berton Gunter <gunter.berton_at_gene.com>
Date: Wed 01 Jun 2005 - 08:43:58 EST


?numeric

Hint: Type numeric(0) and numeric(1) at the prompt and see what you get. What is the sum of anything and a zero length vector?

"The business of the statistician is to catalyze the scientific learning process." - George E. P. Box    

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of luan_sheng
> Sent: Tuesday, May 31, 2005 3:22 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] FW: why is it numeric(0)?
>
> hello,everyone. I have one question:
>
> example 1
> > x=numeric(0)
> > y=5
> > print(x+y)
> numeric(0)
>
> example 2
> > x=numeric(1)
> > y=5
> > print(x+y)
> [1] 5
>
> why the print(x+y) is numeric(0) at the first example, but
> the result is 0
> at the second example?
>
>
> __________________________________________________
>
> QE;"Cb7QGSJOd#-VP9z5ZR;>xN^@,;xSJ<~I'HE3,4sSJOd
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 01 08:51:51 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:17 EST