[R] Difficultes with grep

Fran100681 franaruto at hotmail.it
Fri Jul 11 19:57:17 CEST 2008


Hello everybody!

I'm using R and I have a little problem about function "grep". I 've got to
make a new function in which "grep" is present. So the first argument of
"grep" is the string we want to find,ok..but in this case I define a
function "x" before , x receives an argument in a object "name" (for
instance), then inside function "x" ,i  define a grep.. so i want to set as 
pattern (1st argument of grep)  what i put in "name" and not the string
"name"... how do i do that?

ex:
name <- "Tom"

myfun <- function(name) {
r <- grep ("name", table )
return (r) }
It returns nothing because it searches the word "name" in "table" rather
"Tom"...
I hope to receive some little help because this is stopping me in my projcet
:/ ... i m'not able to reach a solution! Thanks a lot!
-- 
View this message in context: http://www.nabble.com/Difficultes-with-grep-tp18409347p18409347.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list