jeudi 10 décembre 2020

how to use ifTHEN statement

I'm new to R and trying to do simple if/then statements. Using dataframe DFnew, I want to execute:

if "location2" is not missing then "Location" = "location2" 

My code:

library(dplyr)

test %>% DFnew %>%
  if(location2 != NA){
    Location <- location2
  } 

Aucun commentaire:

Enregistrer un commentaire