sample_random_n | R Documentation |
Sample n patients (or other observational units) based on patient IDs.
sample_random_n(id, n)
id |
An integer patient identifier with the following properties:
|
n |
The number of patients (amongst all those who did not experience the event) to be sampled |
Result is TRUE
with probability max(1,n/length(id))
and FALSE
with probability min(0, 1 - n/length(id))
.
Patients are selected in ascending order of patient ID until the sampling number is met.
Warns (does not fail) if n
is greater than length(id)
.
A logical vector indicating whether the patient has been sampled or not
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.