[R] add values inside vector

Grześ gregorio99 at gmail.com
Mon Jun 1 14:36:19 CEST 2009


Yes, it's sum. Thanks. I forgot about this function.
 

Henrique Dallazuanna wrote:
> 
> Use sum:
> 
> sum(vec)
> 
> On Mon, Jun 1, 2009 at 7:15 AM, Grze¶ <gregorio99 at gmail.com> wrote:
> 
>>
>> I think it's easy problem but I can't find solution.
>>
>> I have a vector:
>>
>> vec <- c (23.4, 3.0, 14.7, 7.7)
>>
>> and I would like to add all values which are inside my vector to  each
>> other.
>>
>> as a result a want to get one value  like sum all values from my vector-
>> sth=(23.4 + 3.0 + 14.7 + 7.7)
>>
>> PS. I usually don't know how long is my vector in my function
>> --
>> View this message in context:
>> http://www.nabble.com/add-values-inside-vector-tp23812292p23812292.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> 
> -- 
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
> 
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/add-values-inside-vector-tp23812292p23814313.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list