2
I need to search a df column where the text may not be exact. Example: df$titulo=="SE" & df$titulo=="projeto de pesquisa"
can’t find anything. I’ve tried using like
instead of =
, I’ve tried using df$titulo == "%projeto de pesquisa%"
, but it doesn’t work. Ah! The function subset
doesn’t bring anything either.
Just so you understand better what I am saying, in sql there is a like command that searches part of the string instead of the =
.
Have you tried
agrep("projeto de pesquisa", df$titulo)
? See the instruction help pageagrep
, for inaccurate searches. If you want to search for alternative strings as the question suggests, give an example of the table, edit the question with the output ofdput(head(df, 30))
.– Rui Barradas
@Rui Barradas the function you mentioned returned me the number of lines where the string is, but I want the records relating to this string. Example: id_project, title, advisor, year, beginning, end, ... When the function finds the string, bring the data from these columns relative to these rows.
– André Nascimento
@Rui Barradas got it. I put the value=TRUE parameter in the function.
– André Nascimento