Skip to content
Prev 172833 / 398506 Next

About warnings for non-matched items

The error means that the input you provided to the max function is missing 
or NULL or of length 0.  At a guess, what has happened is that you've 
called grep, which didn't match anything (and so returned integer(0)), 
then used that as an input to max.

To get rid of the warning, check the input to max first.  e.g.

x1 <- c("foo", "bar", "foo")
g1 <- grep("foo", x1)
if(length(g1)) max(g1)

g2 <- grep("baz", x1)
if(length(g2)) max(g1)

Regards,
Richie.

Mathematical Sciences Unit
HSL



------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}