I have a dataset looks like this below.
df <- data.frame(id = c(1,2,3,4,5),
text = c("John S", "John P", "John","Steve","Sam"))
> df
id text
1 1 John S
2 2 John P
3 3 John
4 4 Steve
5 5 Sam
What I would like to do is to recode the values including John as `John' and keep the other same.
My desired output is below:
> df1
id text
1 1 John
2 2 John
3 3 John
4 4 Steve
5 5 Sam
Any ideas? Thanks