2
The situation is as follows: I have a matrix with 271 observations and 14 variables in R. Need to randomly exclude a certain number of crossings and variables, maintaining the order of the remaining crossings and adding NA’s in the excluded crossings.
At present, I can randomly delete and replace the observations ("lines" or "Rows"), using the following code:
X100amostra <- X100[sample(1:nrow(X100), 50,
replace=TRUE),]
where "50" is the number of random exclusions.
Still, I can make exclusions in the form of vectors. I would like to do in the form of matrix.
Any suggestions?