Re: [R] How to generate mutiple set of samples in R?

2019-06-05 Thread PIKAL Petr
Hi Mayooran

It is better to keep your mails on rhelp. Others could answer too.

see in line

> -Original Message-
> From: m.thevar...@massey.ac.nz 
> Sent: Wednesday, June 5, 2019 11:55 AM
> To: PIKAL Petr 
> Subject: Re: How to generate mutiple set of samples in R?
>
> Hello Petr
>   Here given below that manual code (generate first three set of samples
> each contains 200 observations), but I need to write common function for
> generate set of samples,
>
> N <- 1e7
> n <- 200 #sample size
> m <- 3  # number of samples
> indx <- 1:N
> start1 <- sort(sample(indx,1))
this will select **one** random number from indx so easier version is

start1 <- sample(indx,1))

> start2 <- sort(sample(start1+1,1))
> start3 <- sort(sample(start2+1,1))

these will select one random number from 1:start1 or 1:start2, again easier 
version is

start2 <- sample(start1+1,1)
>
> grab.samp1 <- start1:(start1+n-1)
> grab.samp2 <- start2:(start2+n-1)
> grab.samp3 <- start3:(start3+n-1)

and this will just make vector of of 200 consecutive numbers. So

startn <- sample(indx,200)

gives you 200 random numbers from 1:N vector.

And this will give you list of m vectors with 200 consecutive numbers starting 
randomly.

lll <- vector("list", m)
for (i in 1:m) {
lll[[i]] <- startn[i]:(startn[i]+n-1)
}

Is this what you wanted?

Cheers
Petr

>
> grab.samp1
> grab.samp2
> grab.samp3
>
>
> If you have any ideas please let me know.
>
>
> cheers
>
>
> Mayooran
>
>
> _
> Sent from http://r.789695.n4.nabble.com

Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to generate mutiple set of samples in R?

2019-06-05 Thread PIKAL Petr
Hi

Maybe ?sample within cycle? And collecting results in list.

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Thevaraja,
> Mayooran
> Sent: Wednesday, June 5, 2019 4:38 AM
> To: r-help@r-project.org
> Subject: [R] How to generate mutiple set of samples in R?
>
> Hello
>
> I am trying to generate samples from a bulk set of number for my research.
> So I need to get an output which contains various collection of samples, for
> example, sample1, sample2, sample3,  Does anyone suggest any ideas?
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to generate mutiple set of samples in R?

2019-06-05 Thread Enrico Schumann via R-help
> "MT" == Thevaraja, Mayooran  writes:

MT> Hello

MT> I am trying to generate samples from a bulk set of number for my
MT> research. So I need to get an output which contains various
MT> collection of samples, for example, sample1, sample2, sample3,
MT>  Does anyone suggest any ideas?

If you want people to help you, you need to provide
more information about what you want to do.

MT> [[alternative HTML version deleted]]

Please do not post in HTML, but in plain text.

MT> __
MT> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
MT> https://stat.ethz.ch/mailman/listinfo/r-help
MT> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

If you want people to help you, PLEASE DO read this
guide and follow its advice.

MT> and provide commented, minimal, self-contained, reproducible code.


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] How to generate mutiple set of samples in R?

2019-06-05 Thread Thevaraja, Mayooran
Hello

I am trying to generate samples from a bulk set of number for my research. 
So I need to get an output which contains various collection of samples, for 
example, sample1, sample2, sample3,  Does anyone suggest any ideas?






[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.