Use sum:

sum(vec)

On Mon, Jun 1, 2009 at 7:15 AM, Grześ <gregorio99@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@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]]


