It's really helpful for people wanting to help you to have a reproducible example - here's a link to explain how to do this easily: How to make a great R reproducible example
Without a reproducible example, it's a bit difficult to be exact with an answer, but here's something to nudge you in the right direction:
df[grepl("john", df$first_name), ]
I've named the data table df
here and the column containing the name "john" as first_name
.
'grepl' will search the first_name
column for the word john
. The data frame will then be filtered to contain any row where "john" is present.