Skip to content
Prev 320610 / 398506 Next

From a vector with characters to binary information

On 29-03-2013, at 20:01, Hermann Norpois <hnorpois at gmail.com> wrote:

            
Additionally you don't really need to use sapply.

Expressions like these will get you what you want

ifelse(scm=="keine" | scm==" ",0,1)

1 - (scm %in% c("keine"," "))

Berend