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 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) )
>
> or:
>
> m <- matrix(runif(nsim*2), ncol = 2)
> ## if names on m needed
> colnames(m) <- c("x","y")
>
> G
>
> > >  }
> > >
> > > #simulation
> > >> simdata(10)  #correct result
> > >              x           y
> > > [1,] 0.2655087 0.372123900
> > > [2,] 0.1848823 0.702374036
> > > [3,] 0.1680415 0.807516399
> > > [4,] 0.5858003 0.008945796
> > > [5,] 0.2002145 0.685218596
> > > [6,] 0.6062683 0.937641973
> > > [7,] 0.9889093 0.397745453
> > > [8,] 0.4662952 0.207823317
> > > [9,] 0.2216014 0.024233910
> > > [10,] 0.5074782 0.306768506
> > >  But, the dataset "result" wasnot assigned the above values. What is
> > > the
> > > problem?
> > >> result  #wrong result??
> > >       x  y
> > > [1,] NA NA
> > > [2,] NA NA
> > > [3,] NA NA
> > > [4,] NA NA
> > > [5,] NA NA
> > > [6,] NA NA
> > > [7,] NA NA
> > > [8,] NA NA
> > > [9,] NA NA
> > > [10,] NA NA
> > >>
> > > Thanks a lot.
> > > --
> > > -----------------
> > > Jane Chang
> > > Queen's
> > >
> > >     [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > 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.
> >
> > David Winsemius, MD
> > Heritage Laboratories
> > West Hartford, CT
> >
> > ______________________________________________
> > 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.
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
>  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>


-- 
-----------------
Jane Chang
Queen's

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to