how to generate elements not included in my sample

john

This is a bit trivial but how can i generate the set of numbers in x not included in the sample.

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

Rather than sampling the values, sample the 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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I generate random sample data in my Oracle database?

How do i sample 6000 elements out of my 4-d array in numpy

How to generate a valid sample token with stripe?

How to create a random sample from a vector of elements?

How to extract the remaining elements from std::sample

How to properly write elements of a sample in python

How to sample elements in a list nested within a tibble?

How to generate map with included map basing on list of integers?

How do I generate a fixed sized list of facts (duplicates included)?

How to generate all possible k size vectors in a matrix (diagonals included)?

REST/JSON : How to generate sample requests ? How to expose API?

How to generate sample data based on the existing Avro schema?

How to auto-generate a sample Django application from a database schema?

How to generate xml sample form xsd with XMLSchema:sequence

How to generate xml file with an existing dtd for sample of data using Java

How to generate sample XML documents from their DTD or XSD?

How to generate random sample of size 80 with specific split ratio in R?

How to generate a sample using n-order Markov Chains with R?

How to generate a sample of x and y with conditional probability with NumPy

How to make custom callback in keras to generate sample image in VAE training?

R-How to generate random sample of a discrete random variables?

how to generate this url from a sample with mod_rewrite?

How to create a loop to generate increasing sample sizes in a simulation

How do I generate a sample completeness~diversity order plot in iNext?

Python: How to check if element of string is in a string and print the not included string elements?

How do I get the included elements during include in php?

How to get records if only all of the list elements included in nested collections?

How do i get webdriver to see elements in included html files

Generate a dataframe sample