Halabi, Anan
2010-Sep-20 21:21 UTC
[R] Removing slected values from original vector and definning new vector with the rest?
sampleSize <- 20 shape.true <- 1.82 scale.true <- 987 sampWB <- rweibull(sampleSize, shape=shape.true, scale=scale.true) print(sampWB) censidx <- sample(1:length(sampWB), length(sampWB)*0.3) Censored.data <- sampWB[censidx] noncensidx <- defines the rest values of the vector which is not included at Censored.data? [[alternative HTML version deleted]]
Phil Spector
2010-Sep-20 21:28 UTC
[R] Removing slected values from original vector and definning new vector with the rest?
Anan - If you actually want the indices, you can use seq_along(sampWB)[-censidx] If you want the values themselves, then use sampWB[-censidx] - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spector at stat.berkeley.edu On Mon, 20 Sep 2010, Halabi, Anan wrote:> > sampleSize <- 20 > shape.true <- 1.82 > scale.true <- 987 > sampWB <- rweibull(sampleSize, shape=shape.true, scale=scale.true) > print(sampWB) > censidx <- sample(1:length(sampWB), length(sampWB)*0.3) > Censored.data <- sampWB[censidx] > > > noncensidx <- defines the rest values of the vector which is not included at Censored.data? > > > > [[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. >