[R] argument is of length zero

2010-05-11 Thread cobbler_squad
Dear R gurus, We are working on a problem in R - the following script is getting a subset of values from a table that is read in and calculating the average of these values in the subset defined. the table looks like this: subject stim trial xmax ymax xmin ymin flag 1 4 dur1

Re: [R] argument is of length zero

2010-03-11 Thread jim holtman
Test for the condition you are looking for. If the grep does not match, it returns a vector of length zero > a='hello world' > if (length(grep('hellow',a)) != 0) { + print("wow") + } else { + print("wow2") +} [1] "wow2" > On Thu, Mar 11, 2010 at 6:59 PM, Dan Joo wrote: > I am new to R, so

[R] argument is of length zero

2010-03-11 Thread Dan Joo
I am new to R, so I beg your indulgence. > a='hello world' > if (grep('hellow',a)) { print("wow") } else { print("wow2") } Error in if (grep("hellow", a)) { : argument is of length zero What is the proper syntax to ensure that "wow2" gets printed? Thank you for your help! Dan [[alte