[R] help on using 'sum' in writng a function

skim033 at student.ucr.edu skim033 at student.ucr.edu
Sun Apr 9 21:53:38 CEST 2006

Hi, I am writing a function that includes 'sum' function 
such as:
expecting f to be -1+x+0+x+1+x=3x. But I found out that f is 
sum(x). So, f is always a scalar, which means that f(c(0,1)) 
is not a vector as c(0,3), but 3(0+1)=3. I would like to ask 
you helping me in solving this problem. I would like to 
thank you in advance.
UC riverside.

More information about the R-help mailing list