Dear R users,

I'm trying to randomly recreate a real dataset with missing data and I'm not quite sure if I can use the sample command for this. I think it might be better to do it in 2 steps and randomly replace the sampled data with missing data...

So something like this

x <- sample(10000:20000, 100) #without replacement

Now I want x to contain to 20% missing data (NA). Could anyone help me how to do this?

Thanks
Joanne

--
========================================

Joanne Demmler Ph.D.
Research Assistant
School of Medicine
Swansea University
Singleton Park
Swansea SA2 8PP
UK
tel:            +44 (0)1792 295674
fax:            +44 (0)1792 513430
email:          j.demm...@swansea.ac.uk
DECIPHer:       www.decipher.uk.net

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to