mercredi 28 janvier 2015

Error in sample.int(length(x), size, replace, prob) : invalid first argument

I am running the following lines of code and facing the above-mentioned error. Any ideas how to fix this?



install.packages("operator.tools")
X <- NULL
S <- NULL
remove.valuex <- NULL
N <- seq.int(1,25)

library(operator.tools)

repeat {

S<-sample(N ,1, replace = FALSE, prob = NULL)
S
if (S==1) {
remove.value<-c(S,S+1)
} else if (S==25) {
remove.value<-c(S,S-1)
}else {remove.value<-c(S-1,S,S+1)
}
remove.value

N <- N [which(N %!in% remove.value)]
N


if (is.null(N)) break }





Aucun commentaire:

Enregistrer un commentaire