[R] problem in R-code
thanoon younis
thanoon.younis80 at gmail.com
Wed Nov 4 04:02:55 CET 2015
Dear R-users
I have a problem in the code below, the problem is because i want to change
the variable BZ which is a vector with 200x1 dimension to the var. W which
is categorical variable with same dimension of BZ but with categorical
values with 4 categories but i got on only zero values in w why? any help
would be appreciated.
N<-200;P<-9 #Sample size
BZ=numeric(N)
W<-numeric(N)
for (t in 1:1) {
#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[j] < 0.25){
W[j] = 1
}else if(BZ[j] >=0.25 & BZ[j] < 0.5){
W[j] = 2
}else if(BZ[j] >=0.5 & BZ[j] < 0.75){
W[j] = 3
}else{
W[j] = 4
}}
#Input data set
data<-list(N=200,P=9,Q=W)
}} #end
W
Regards
--
Thanoon Y. Thanoon
PhD Candidate
Department of Mathematical Sciences
Faculty of Science
University Technology Malaysia, UTM
E.Mail: Thanoon.younis80 at gmail.com
E.Mail: dawn_prayer80 at yahoo.com
Facebook:Thanoon Younis AL-Shakerchy
Twitter: Thanoon Alshakerchy
H.P:00601127550205
[[alternative HTML version deleted]]
More information about the R-help
mailing list