[R] extracting parts of words or extraxting letter to use in ifelse-func.
frederic.patrizio at gmail.com
Fri Feb 13 11:03:54 CET 2009
I had a quick look at your code. In this line:
b2$PRRSvac <- ifelse(b2$status=="MS-X, PRRS-pos"|b2$status=="R�d
some special characters are used. You must use only plain ascii characters
Hope this help.
2009/2/13 joe1985 <johannes at dsr.life.ku.dk>:
> I want to make some variables with the ifelse-function, but i don't know how
> to do it.
> I want to make these five variables;
> b2$PRRSvac <- ifelse(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)
> 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 text-file i've used, and the R-kode.
> Hope anyone can help me?
> R-kode (just run from line 1-22) ;
> View this message in context: http://www.nabble.com/extracting-parts-of-words-or-extraxting-letter-to-use-in-ifelse-func.-tp21993098p21993098.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help