Description Usage Arguments Examples
mcar() alows the user to forcibly input missing values (NA) that replicates being missing completly at random. This kind of missing data is missing by random chance.
1 |
data |
The data that you want to give missing values to |
p |
The percentage of data that you want to make missing. |
column = NULL |
When NULL the function will run through your whole data set Set a value to target specific columns |
1 2 3 4 5 6 7 8 9 10 11 | ## Inputs missing data in the first two columns of the data set df
df<- data.frame(x=rnorm(100, 10, 2), y=rpois(100,4), z=rbinom(100, 1, .4))
df_missing<- mcar(df, .25, 1:2)
sum(is.na(df_missing))/200
## Inputs missing data into all of the columns in df2
df2<- data.frame(x=rnorm(100, 10, 2), y=rpois(100,4), z=rbinom(100, 1, .4))
df_missing2<- mcar(df2, .25)
sum(is.na(df_missing2))/300
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.