Thank you very much for your help,

I was wondering if is possible to sample randomly specifying to select in a
particular group of data inside the matrix, for example only within the
whole samples collected in 2011 I would randomly choose 20 random samples...

Thanks a again,


Gian

On 13 September 2012 12:26, anna freni sterrantino <annafr...@yahoo.it>wrote:

> Hello Gian,
> sure sample function
> will do it for your sampling.
>
> a=as.data.frame(matrix(1:20,4))
> sample(rownames(a),2)
>
> see ?sample for more details.
> Hope it helps
>
> Cheers
>
> Anna
>
>
> Anna Freni Sterrantino
> Department of Statistics
> University of Bologna, Italy
> via Belle Arti 41, 40124 BO.
>   ------------------------------
> *Da:* Gian Maria Niccolò Benucci <gian.benu...@gmail.com>
> *A:* r-help@r-project.org
> *Inviato:* Giovedì 13 Settembre 2012 10:42
> *Oggetto:* [R] random sampling inside a dataset
>
> Hi all,
>
> I am wondering if do exist a function in R that allow me to sample or
> choose randomly the rows (i.e., samples) inside a given matrix.
> Thank you very much in advance.
> Cheers,
>
> --
> Gian
>
>     [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
>


-- 
Gian Maria Niccolò Benucci, PhD
Department of Applied Biology
University of Perugia
Borgo XX Giugno, 74
06121 - Perugia, ITALY



*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*

        [[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