Re: [R] Difficultes with grep

2008-07-14 Thread Fran100681
Thank you very much for all messages and answers, it's ok now :) Charles C. Berry wrote: > > On Sun, 13 Jul 2008, Fran100681 wrote: > >> >> Thank you, but this is not what i want exactly.. i would want to launch >> function "myfun" with this script: >> >>> table <- sample(LETTERS[1:5], 20,TRU

Re: [R] Difficultes with grep

2008-07-13 Thread jim holtman
or your function looks like this were you dynamically create the string: myfun <- function(name) { r <- grep (paste(name, "[^0-9]", sep=""), table ) return (r) } On Sun, Jul 13, 2008 at 7:24 AM, Fran100681 <[EMAIL PROTECTED]> wrote: > > Thank you, but this is not what i want exactly.. i would wa

Re: [R] Difficultes with grep

2008-07-13 Thread Charles C. Berry
On Sun, 13 Jul 2008, Fran100681 wrote: Thank you, but this is not what i want exactly.. i would want to launch function "myfun" with this script: table <- sample(LETTERS[1:5], 20,TRUE) name <- "A" myfun <- function(name) { + r <- grep (name[^0-9], table ) ...XX

Re: [R] Difficultes with grep

2008-07-13 Thread Fran100681
Thank you, but this is not what i want exactly.. i would want to launch function "myfun" with this script: > table <- sample(LETTERS[1:5], 20,TRUE) > > name <- "A" > > myfun <- function(name) { + r <- grep (name[^0-9], table ) + return (r) } but if I do it ,R doesn't accept this.. i want this be

Re: [R] Difficultes with grep

2008-07-11 Thread jim holtman
I think this is what you want > table <- sample(LETTERS[1:5], 20,TRUE) > > name <- "A" > > myfun <- function(name) { + r <- grep (name, table ) + return (r) } > > myfun(name) [1] 4 7 14 18 > table [1] "E" "B" "D" "A" "B" "B" "A" "B" "E" "B" "C" "C" "C" "A" "E" "D" "D" "A" "D" "C" > On Fri, Ju

[R] Difficultes with grep

2008-07-11 Thread Fran100681
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