I have a data frame with the months June, May, July with various values. I am trying to create new columns for each month with new values. If the value is greater than or equal to 100 I would like it to be changed to 100 and in below 100 keep the value. Here is the df:
June <- c(100,50,200)
May <- c(250, 100, 20)
July <- c(20, 300, 20)
df <- data.frame(June, May, July)
and my goal is to have the df look like this:
June <- c(100,50,200)
May <- c(250, 100, 20)
July <- c(20, 300, 20)
June_new <- c(100,50,100)
May_new <- c(100,100,20)
July_new <- c(20,100,20)
df2 <- data.frame(June, May, July,June_new, May_new, July_new)
Thank you
Aucun commentaire:
Enregistrer un commentaire