Message-ID: <D525FC37-C06B-4011-90CC-A521620F18DD@comcast.net>
Date: 2009-03-16T14:46:53Z
From: David Winsemius
Subject: Select a random subset of rows out of matrix
In-Reply-To: <FCE3439777D52842B1D4831921FCA0D185140ACEE5@EXIDEFIX01.whu.edu>
On Mar 16, 2009, at 10:34 AM, Haenlein.Michael wrote:
> Dear all,
>
> I have a large dataset (N=100,000 with 89 variables per subject).
> This dataset is stored in a 100.000 x 89 matrix where each row
> describes one individual and each column one variable.
>
> What is the easiest way of selecting a subset of let's say 1.000
> individuals out of that whole matrix?
bigmatrix[ sample( 1:nrow(bigmatrix), 1000, replace=FALSE), ]
>
>
> Thanks,
>
> Michael
>
>
> Michael Haenlein
> Associate Professor of Marketing
> ESCP-EAP European School of Management
> Paris, France
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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