lundi 17 septembre 2018

Append results of loop to data frame R

I'd like to append the results of the loop below to an existing data frame. Not sure how to do this.

  for (i in group_yr2$Temp) {
    if(i <= 2){
      print("Critically Cold")
    } else if (i > 2 & i <= 15){
      print("Cold")
    } else if (i > 15 & i <= 126){
      print("Above Normal")
    } else 
      print("Hot")
  }  

Aucun commentaire:

Enregistrer un commentaire