Re: [R] From a vector with characters to binary information

2013-03-30 Thread arun
Hi,  1*is.na(match(scm,c("keine"," "))) # [1] 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 #or  1*(!scm%in%c("keine"," "))  #[1] 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 A.K. - Original Message - From: Hermann Norpois To: r-help@r-project.org Cc: Sent: Friday, March 29, 2013 3:01 PM Subject:

Re: [R] From a vector with characters to binary information

2013-03-30 Thread Berend Hasselman
On 29-03-2013, at 20:01, Hermann Norpois wrote: > Hello, > > I would like to transform a character vector into a "binary" vector > ("keine" and " " become 0 and the rest 1). > >> dput (scm) > c("keine", " ", "keine", "Erstgradverw.", "Mutter", "Erstgradverw.", > "Erstgradverw.", "keine", " ",

Re: [R] From a vector with characters to binary information

2013-03-30 Thread Berend Hasselman
On 29-03-2013, at 20:01, Hermann Norpois wrote: > Hello, > > I would like to transform a character vector into a "binary" vector > ("keine" and " " become 0 and the rest 1). > >> dput (scm) > c("keine", " ", "keine", "Erstgradverw.", "Mutter", "Erstgradverw.", > "Erstgradverw.", "keine", " ",