I was trying to write a function in R that reads two words from me and then prints out all strings that contains both of those two words.
I have a data.frame named x and first column is where I need to search the strings from.
I wrote:
findcontain <- function{
Clue1 <- readline(prompt= "Enter the first Clue.")
Clue2 <- readline(prompt= "Enter the second Clue.")
Clues <- paste(Clue1, "&", Clue2, sep="")
grep(Clues, x[1,])}
This isn't working... What did I miss? Please help.