I am trying to create a new column in a data frame using mutate. This should match values in two columns between 2 different data frames, and ID and a step number, and then return the value from a third column in my second data frame. Hopefully my code below makes it a little clearer what I'm trying to achieve!
Is this the right way to go about it, I've looked into using merge but don't think that quite does what I need.
Step1 <- iData %>%
filter(IndicatorID == 43) %>%
mutate(Step = 1) %>%
mutate(iresult = InputA + InputB) %>%
mutate(stepname = ifelse(IndicatorID == Step$IndicatorID & Step==Step$Step,Step$StepName, ""))
Basically, it should look to find the row in Step where the Indicator is 43 and Step = 1, then put the value in the new column, in this case it would be "Gross value added". Any help will be really appreciated!