r - how to generate elements not included in my sample -


this bit trivial how can generate set of numbers in x not included in sample.

x=rnorm(6,0,1) k=sample(x,3) 

rather sampling values, sample indexes.

set.seed(15) (x <-rnorm(6,0,1)) # [1]  0.2588229  1.8311207 -0.3396186  0.8971982  0.4880163 -1.2553858 idx <- sample(length(x),3) (selected <- x[idx]) # [1]  0.8971982 -1.2553858  0.4880163 (notselected <- x[-idx]) # [1]  0.2588229  1.8311207 -0.3396186 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -