I have three items that need to be recoded:
data$tweede_lockdown_1_w2<-as.factor(recode_factor(data$tweede_lockdown_1_w2,'2'='1', '3'='2','6'='3','7'='4','8'='5'))
data$tweede_lockdown_2_w2.r<-as.factor(recode_factor(data$tweede_lockdown_2_w2.r,'2'='1', '3'='2','6'='3','7'='4','8'='5'))
data$tweede_lockdown_3_w2<-as.factor(recode_factor(data$tweede_lockdown_3_w2,'2'='1', '3'='2','6'='3','7'='4','8'='5'))
But, when I do that, I see that nothing has changed in the data.
although the use of as.factor is unecesary and can be removed, and the mix of dplyr and base R seems odd (given the particular context where the same transformation is repeated and purer dplyr use would be more concise), I can't see anything syntactically wrong with your code to where it wouldnt be changing.
# example data
data <- data.frame(tweede_lockdown_1_w2=factor(2))
The problem is that although I recoded for example the 2 to 1, it seems like it hasn't changed, because the minimum value is still 2 and the maximum value is 8 (which should not be possible, because the maximum value I insurted was 5).
summary(dataset$tweede_lockdown_1_w2)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
2.000 6.000 7.000 6.454 8.000 8.000 127
summary(dataset$tweede_lockdown_2_w2)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
2.000 3.000 6.000 5.448 7.000 8.000 126
summary(dataset$tweede_lockdown_3_w2)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
2.00 2.00 3.00 4.13 6.00 8.00 127
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one: