I have the D Data.frame that has values for Stations. I do have another data.frame F that has Stations threshold values for certain conditions (Ie., WBN, AN etc). I would like to use the value of each Stations in D to see under which conditions it falls in F and save the D data.frame with an added column for Conditions in DF. Here is my sample code
library(tidyverse)
set.seed(123)
D <- data.frame(Stations = c("A","S","D","Z"), Value = c(15,10,25,16))
F <- data.frame(Stations = c("A","S","D","Z"), WBN = runif(4, 0, 3), BN = runif(4, 3,6),
N = runif(4,7,10), AN = runif(4,15,25))
Desired output I should get a data.frame like below
DF <- D %>% mutate(Condition = c("AN", "AN", "AN", "AN" ))
Aucun commentaire:
Enregistrer un commentaire