Hi Adam,
You're in luck, arithmetic operations in R are vectorized so it does
not take any extra effort.
x <- 1:10
sum(x^2)
cheers,
Josh
On Sun, Nov 13, 2011 at 12:20 PM, covfish87 wrote:
> hi, basic question
>
> how do i write a function that sums the squares of elements in a vector of
> an
hi, basic question
how do i write a function that sums the squares of elements in a vector of
any length?
thanks
Adam
--
View this message in context:
http://r.789695.n4.nabble.com/sum-of-squares-function-tp4037402p4037402.html
Sent from the R help mailing list archive at Nabble.com.
_
2 matches
Mail list logo