Description Usage Arguments Value Author(s) Examples
add random NAs to a data.frame
1 | generateRandomNAs(df, protected, numberOfNAs, seed)
|
df |
input |
protected |
are cols of the data.frames which need to be proteced from random NAs |
number |
of NAs that should be introduced. |
seed |
for reproducible random number generation |
data.frame that contains several random NAs within its questions
Matthias Bannert
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # generate survey likerandom sample
srvyData <- generateSamplePanel(500,3,"quarterly",
c(1999,1),
c(1999,1),
weight=round(runif(500,2,80)))
# generate
grps <- generateRandomGroups(3,1:500,LETTERS)
# merge group information by uid
srvyWgroups <- merge(grps,srvyData,by="uid")
# add some NAs (to simulate item non-response)
# check which cols should be protected from
# being hit by random NAs
head(srvyWgroups)
randomPanel <- generateRandomNAs(srvyWgroups,c(1,2,3,4),50,1)
randomPanel
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.