Re: [R] Why cannot get the expected values in my function

2009-12-09 Thread Gavin Simpson
On Tue, 2009-12-08 at 23:22 -0500, David Winsemius wrote: On Dec 8, 2009, at 11:07 PM, rusers.sh wrote: Hi, In the following function, i hope to save my simulated data into the result dataset, but why the final result dataset seems not to be generated. #Function

Re: [R] Why cannot get the expected values in my function

2009-12-09 Thread rusers.sh
Thanks very very much. It is really not easy to change from one language to another. :) 2009/12/9 Gavin Simpson gavin.simp...@ucl.ac.uk On Tue, 2009-12-08 at 23:22 -0500, David Winsemius wrote: On Dec 8, 2009, at 11:07 PM, rusers.sh wrote: Hi, In the following function, i hope to

[R] Why cannot get the expected values in my function

2009-12-08 Thread rusers.sh
Hi, In the following function, i hope to save my simulated data into the result dataset, but why the final result dataset seems not to be generated. #Function simdata-function (nsim) { result-matrix(NA,nrow=nsim,ncol=2) colnames(result)-c(x,y) for (i in 1:nsim) { set.seed(i) result[i,]-

Re: [R] Why cannot get the expected values in my function

2009-12-08 Thread David Winsemius
On Dec 8, 2009, at 11:07 PM, rusers.sh wrote: Hi, In the following function, i hope to save my simulated data into the result dataset, but why the final result dataset seems not to be generated. #Function simdata-function (nsim) { # Instead why not: cbind(x=runif(nsim), y=runif(nsim) )