[R] some R exercises

Florian Weiler fweiler08 at jhubc.it
Wed May 9 13:35:52 CEST 2012


Just thought about it, you can have this of course "cheaper" without the
loops. Like this:

fun1 <- function(x) sum((x-mean(x))^2)/(length(x)+1)
fun2 <- function(x) sum((x-mean(x))^2)/(length(x))

x <- rexp(15)
fun1(x)
fun2(x)

--
View this message in context: http://r.789695.n4.nabble.com/some-R-exercises-tp4619850p4620163.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list