powered by
Creates a random sample keeping the proportions of 1 and 0 that are in label.
label
preselected.sample(label, ns)
vector of 0 and 1.
sample size, contain ns random index of label.ns has to be lower than length of label.
ns
a vector of size ns containing random index of label.
The aim of this method is to select randomly ns index of label. This function returns a vector of size ns composed of random rank of label.
# NOT RUN { #load data data(BreastCancer) index<-preselected.sample(BreastCancer$Y,10) index BreastCancer$Y[index] # }
Run the code above in your browser using DataLab