[R] problem in R-code
thanoon younis
thanoon.younis80 at gmail.com
Wed Nov 4 10:02:40 CET 2015
Dear R-Users
After correct some errors in the code below i have only this error
"Error in if (BZ[i] < 0.25) { : missing value where TRUE/FALSE needed"
how can i solve this problem please?
N<-200;P<-9 #Sample size
BZ=matrix(NA, nrow=N, ncol=1)
W=matrix(NA, nrow=N, ncol=1)
for (t in 1:100) {
#Generate the data for the simulation study
for (i in 1:N) {
#transform theta to ordered categorical variables
for(j in 1:1){
if(BZ[i] < 0.25){
W[i] = 1
}else if(BZ[i] >=0.25 & BZ[i] < 0.5){
W[i] = 2
}else if(BZ[i] >=0.5 & BZ[i] < 0.75){
W[i] = 3
}else{
W[i] = 4
}}}}
[[alternative HTML version deleted]]
More information about the R-help
mailing list