jeudi 26 août 2021

Trying to run an "if" statement in R. Want to run a chunk of code on if my variable is a certain value

I want to run a chunk of code on if my variable values is "1099".

Further up the code I assign a value to a variable called "Phone Code" i.e.,

Phone Code <- "1099"

I want to run a chunk only if this value is "1099". Sometimes I run the code and use the value 1098 which means I don't want that specific code to run.

Currently I have tried the following:

if (Phone Code <- "1099"){

CODE HERE

}

Aucun commentaire:

Enregistrer un commentaire