Skip to content
Prev 34597 / 63421 Next

bug in `pmatch' (error with too long 'choices')?

I believe the answer is that you are missing something: partial matching.

The 651'st elt of colors() is "whitesmoke", so it is ambiguous whether 
"whit" matches "white" or "whitesmoke". When you leave out the 651'st 
elt, "whit" happily matches "white".

 > which(substring(colors(), 1, 4)=="whit")
[1] 1 651
 > colors()[which(substring(colors(), 1, 4)=="whit")]
[1] "white" "whitesmoke"
 > match.arg("whit", colors()[1:650])
[1] "white"
 > match.arg("whit", colors())
Error in match.arg("whit", colors()) :
'arg' should be one of ?white?, ?aliceblue?, ...
 > match.arg("whit", colors()[c(1,651)])
Error in match.arg("whit", colors()[c(1, 651)]) :
'arg' should be one of ?white?, ?whitesmoke?
 >

-- Tony Plate
Joerg van den Hoff wrote: