0
我试图在R中编写一个函数来读取我的两个单词,然后打印出包含这两个单词的所有字符串。R:用户自定义函数来查找包含两个字符串的字符串
我有一个名为x的数据框,第一列是我需要从中搜索字符串的地方。
我写道:
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,])}
这是不工作...我错过了什么?请帮忙。
请阅读[如何提出一个很好的问题(HTTP的信息:// stackoverflow.com/help/how-to-ask)以及如何给出[可重现的例子](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/ 5963610)。这会让其他人更容易帮助你。 – Jaap