sebastian-c / overflow

An R package to assist people answering R questions on Stack Overflow
14 stars 12 forks source link

Add function to add random NAs #21

Open sebastian-c opened 10 years ago

sebastian-c commented 10 years ago

Tyler Rinker's original function included a parameter to add NAs. I propose to add this as a separate function so that sorandf (or any other object) can be wrapped in it and have NAs added. The proposed syntax is:

soaddnas(object, columns="all", narate=0.1)

Where columns is an integer representing which columns should have NAs added and narate is a percentage of elements which should be turned into NA.