Re: [R] Help with functions (iterations)

2007-09-30 Thread Mark Wardle
Dear Letticia, Are you using R-help for your homework? See your previous postings: 1. 15th September: With a single R command complete the following: create a vector calles seqvec that repeats the sequence 1, 3,6, 10,15,21.( I was trying to use c() but this does not work) create a 5-row, 6-col

Re: [R] Help with functions (iterations)

2007-09-29 Thread jim holtman
I think this might be what you want: ex1.fcn<-function(x){ h<-4/(1+x^2) return(h) } my.pi <- function(sample.size, sim.size, low, hi, func) { # create output vector result <- numeric(sample.size) for (i in seq(sample.size)){ # loop for 'sample.size' times my.rand.x <- runif(si

[R] Help with functions (iterations)

2007-09-29 Thread Letticia Ramlal
Hello: I am a bit confused by this problem. Can anyone give me some advice on this I would greatly appreciate it. Thank you for all your help. Need to create a for loop that saves the estimate of pi from each 0f 100 separate iterations and store it in a numeric vector (of length 100). The for