```
#' Generate P/N sample
#'
#' @param X Population Covariates
#' @param y Population response
#' @param np number of positive subjects
#' @param nn number of negative subjects
#' @param replace if TRUE, sample with replacement
#' @export
GenPNSample = function(X,y,np,nn,replace = FALSE){
repl = replace
# sample labelled data
posind =which(y==1) # where subject is positive
sampp = sample(x = posind,size = np,replace = repl)
X_p = X[sampp,]
y_p = y[sampp]
# sample neg-labelled data
negind =which(y==0) # where subject is positive
sampn = sample(x = negind,size = nn,replace = repl)
X_n = X[sampn,]
y_n = y[sampn]
return(list(X=X,y=y,X_p=X_p,X_n = X_n,sampp=sampp,sampn = sampn))}
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.