尝试复制替换2个值而不是3个值的旧工作代码,但这不起作用。这是:
Names <- c("Robert", "Mandy", "Mordecai")
Search <-function(find,relace,type){
gsub("find","relace",type)
}
Search("o","ooo", Names) #getting Names vector but no replacements
您需要通过gsub调用从行中删除"
。试试:
gsub(find,relace,type)