Displaying 3 results from an estimated 3 matches for "totalvac".
2009 Feb 19
2
Use of ifelse for indicating specific rownumber
...865 1036 1051 1062 1068
1092 1109 1171 1187 1283 1293 1325 1335 1342 1360 1379 1414 1419 1425 1447
1452
[61] 1465 1489 1512 1518
So what i want is that everytime the rownumber equals a number in "i" (which
obviously indicate a rownumber i b2), i want it indicated in a vector called
b2$totalvac. Fx. in rownumber 22 in b2 the
b2$totalvac vector should have the value 1.
So thougth of b2$totalvac <- ifelse(,1,0), but i don't what to put as the
"if"-sentence.
Hope you can help me
--
View this message in context: http://www.nabble.com/Use-of-ifelse-for-indicating-specific...
2009 Feb 13
2
extracting parts of words or extraxting letter to use in ifelse-func.
...e(b2$status=='A' | b2$status=='Aa',1,0)
b2$PRRSdk <- ifelse(b2$status=='B' | b2$status=='Bb',1,0)
b2$sanVac <- ifelse(b2$status=='C' | b2$status=='sanAa',1,0)
b2$sanDk <- ifelse(b2$status=='D' | b2$status=='sanBb',1,0)
b2$totalvac <- ifelse(b2$status=='San',1,0)
And
b2$UGT <- ifelse(b2$status=='UGT',1,0)
b2$KOM <- ifelse(b2$status=='KOM',1,0)
But, as one from this forum told me, it doesn't work because the words is in
a wrong format or something like that.
I have attached the tex...
2009 Feb 13
0
Odp: Odp: extracting parts of words or extraxting letter to use in ifelse-func.
...> >> b2$PRRSdk <- ifelse(b2$status=='B' | b2$status=='Bb',1,0)
> >> b2$sanVac <- ifelse(b2$status=='C' | b2$status=='sanAa',1,0)
> >> b2$sanDk <- ifelse(b2$status=='D' | b2$status=='sanBb',1,0)
> >> b2$totalvac <- ifelse(b2$status=='San',1,0)
> >
> > Basically you do not need ifelse
> >
> > b2$status=='San'
> >
> > gives you logical vector and you can directly multiply it by 1 to get
1
> > for TRUE and 0 for FALSE
> >
> > 1*(b...