Hello, Just run your code and every time there's an error correct it.
number <- c(0,1,3,4,5,6,8) rsidp <- function(x){ y <- sample(number,x,replace=TRUE) y # don't need return() } plot(0, xlim=c(0,20), ylim=c(0,20), type="n", xlab="Sample size", ylab="Sample variance") for (i in seq(1:20)){ retVal=rsidp(i) points (i, var(retVal),pch=i,col=i) } Hope this helps, Rui Barradas Em 26-10-2012 15:40, Rlotus escreveu:
number<-c(0,1,3,4,5,6,8) rsidp<-function(x){ i=0 {y<-sample(number,x,replace=TRUE)} return(y) } plot(o, xlim=c(0,20), ylim(0,20), type="n", xlab="Sample size", ylab="Sample variance") for (i in seq(1:20)){ retVal=rsidp(i) var(rsidpVector) points (i, var(rsidpVector),pch=i,col=i) } -- View this message in context: http://r.789695.n4.nabble.com/Why-my-code-does-not-draw-how-to-fix-it-plz-tp4647556.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.
______________________________________________ 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.