-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf
>> Of peter dalgaard
>> Sent: Wednesday, October 23, 2013 12:37 PM
>> To: erinu
>> Cc: r-help@r-project.org
>> Subject: Re: [R] How to view un-sampled data from a randomly sampled datas
hi bert-
all of the values are unique, so the random sample of everything was also
a random sample of all unique numbers.
Erin
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-view-un-sampled-data-from-a-randomly-sampled-dataset-tp4678887p4678908.html
Sent from the R hel
-help@r-project.org
> Subject: Re: [R] How to view un-sampled data from a randomly sampled dataset
>
>
> On Oct 23, 2013, at 20:13 , erinu wrote:
>
> > Hi there-
> >
> > I have a 150 row dataset (data). I create "y" a randomly sampled (without
> &
r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>> project.org] On Behalf Of erinu
>> Sent: Wednesday, October 23, 2013 11:14 AM
>> To: r-help@r-project.org
>> Subject: [R] How to view un-sampled data from a randomly sampled
>> dataset
>>
>> Hi there-
Thanks guys! Easy, quick fix!
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-view-un-sampled-data-from-a-randomly-sampled-dataset-tp4678887p4678905.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proj
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of erinu
> Sent: Wednesday, October 23, 2013 11:14 AM
> To: r-help@r-project.org
> Subject: [R] How to view un-sampled data from a randomly sampled
> dataset
On Oct 23, 2013, at 20:13 , erinu wrote:
> Hi there-
>
> I have a 150 row dataset (data). I create "y" a randomly sampled (without
> replacement) set number of observations (40):
>
> y<-data[sample(1:nrow(data),40,replace=FALSE),]
>
> I would like to make a new variable "x" that contains the l
Hi there-
I have a 150 row dataset (data). I create "y" a randomly sampled (without
replacement) set number of observations (40):
y<-data[sample(1:nrow(data),40,replace=FALSE),]
I would like to make a new variable "x" that contains the leftover
non-sampled 110 observations. I am sure there is a
HI,
You may try:
set.seed(432)
dat1 <- data.frame(Col1=1:150,Col2=rnorm(150))
y <- dat1[sample(1:nrow(dat1),40,replace=FALSE),]
x <- dat1[-as.numeric(row.names(y)),]
dim(x)
#[1] 110 2
intersect(row.names(x),row.names(y))
#character(0)
#or
x1 <- dat1[!row.names(dat1) %in% row.names(y),]
iden
9 matches
Mail list logo