mercredi 2 septembre 2015

Adding random numbers to the end of a vector

Why do I get a NULL result from this code. I am completely new to R so can someone please tell me what's wrong with this code. I am trying to generate a series of values and find their median values and add these median values to the end of a vector.

medainfunc<-function(n,mu,sigma,iterate){
  m<-c()
  for (i in itreate){
    x<-rnorm(n,mu,sigma)
    y<-median(x)
    m<-c(m,y)
  }
  m
}
medianfunc(10,3,15,10000)
NULL




Aucun commentaire:

Enregistrer un commentaire