rdatarepl | R Documentation |
Replaces data in the original data matrix using a specified replacement matrix.
rdatarepl(Dx, RM, printfp = TRUE)
Dx |
Data frame or matrix to be replaced. |
RM |
Replacement matrix. |
printfp |
Logical, if |
Replacement matrices can be obtained from the replacement.matrix
function.
Returns a list with two elements:
Fx |
The replaced (fake) data matrix. |
Fperc |
Percentage of replaced data. |
Massimiliano Pastore
replacement.matrix
require(MASS) set.seed(20130207) Dx <- rdatagen(R=matrix(c(1,.3,.3,1),2,2),Q=5)$data RM <- replacement.matrix(p=c(.6,0)) Fx <- rdatarepl(Dx,RM)$Fx par(mfrow=c(2,2)) for (j in 1:ncol(Dx)) barplot(table(Dx[,j]),main="original data") for (j in 1:ncol(Fx)) barplot(table(Fx[,j]),main="replaced data")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.