Re: [R] what is returned if a match is not found using grep

2009-08-11 Thread Duncan Murdoch
Rnewbie wrote: sorry, I still have a question. What is the difference between an empty vector and a vector of length 0? When I assign x<-c() is.null(x) is TRUE x<-integer(0) is.null(x) is FALSE NULL is a special object in R. is.null() returns TRUE for it. c() returns it. integer(0) is

Re: [R] what is returned if a match is not found using grep

2009-08-11 Thread Rnewbie
sorry, I still have a question. What is the difference between an empty vector and a vector of length 0? When I assign x<-c() is.null(x) is TRUE x<-integer(0) is.null(x) is FALSE Duncan Murdoch-2 wrote: > > Rnewbie wrote: >> dear all, >> >> I tried to use grep to match IDs in two dataframes >

Re: [R] what is returned if a match is not found using grep

2009-08-11 Thread Rnewbie
Thank you very much!!! Duncan Murdoch-2 wrote: > > Rnewbie wrote: >> dear all, >> >> I tried to use grep to match IDs in two dataframes >> >> grep(DF1$ID[i], DF2$ID) >> >> I wanted to use condition in a loop, but I have the problem to define >> what >> is in return if a match is not found. I us

Re: [R] what is returned if a match is not found using grep

2009-08-11 Thread Duncan Murdoch
Rnewbie wrote: dear all, I tried to use grep to match IDs in two dataframes grep(DF1$ID[i], DF2$ID) I wanted to use condition in a loop, but I have the problem to define what is in return if a match is not found. I used mode() and class() to compare between the attributes when a match is found

[R] what is returned if a match is not found using grep

2009-08-11 Thread Rnewbie
dear all, I tried to use grep to match IDs in two dataframes grep(DF1$ID[i], DF2$ID) I wanted to use condition in a loop, but I have the problem to define what is in return if a match is not found. I used mode() and class() to compare between the attributes when a match is found and not found,