Try this:

sum(a * c(100, 10, 1)) + sum(b * c(10, 1))


On Tue, Feb 1, 2011 at 2:22 AM, ADias <diasan...@gmail.com> wrote:

>
> Hi
>
> I am trying to create a function that is able to calculate this sum:
>
> a<-c(2,3,5)
> b<-(8,7)
>
> with "a" meaning 235 and "b" 87. So the result of this sum would be 235 +
> 87
> = 322.
>
> I've searched a function like strsplit but that worked for integers and in
> reverse - not spliting but combining.
>
> Can you give me a hand on this please?
>
> thanks
> AD
> --
> View this message in context:
> http://r.789695.n4.nabble.com/sum-the-values-in-a-vector-as-a-complete-number-tp3250470p3250470.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]]

______________________________________________
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.

Reply via email to