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

Berton Gunter gunter.berton at gene.com
Wed Jun 1 00:43:58 CEST 2005


?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?

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of luan_sheng
> Sent: Tuesday, May 31, 2005 3:22 PM
> To: r-help at 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 at 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
>




More information about the R-help mailing list