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:
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", " ",
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", " ",
3 matches
Mail list logo