samedi 22 février 2020

Placeholders in R

i have a dataset, where different variables can only be identified by the digit where a 1 occurs.All variables consist of 5 digits. Now i need to create distinct variables. My Question now is, whether there is a way similiar to Excel to set placeholders in order to identify those.

What i have done so far is:

w$r <- ifelse(w$f == 1****, 1, 0)

Here, i wanted to filter out all variables, where 1 is the first digit. It is noteworthy, that some variables have an reoccuring 1 e.g. on 2 digits.

Aucun commentaire:

Enregistrer un commentaire