Skip to content
Prev 388556 / 398513 Next

ls() pattern question

On 14/07/2021 8:21 p.m., Bert Gunter wrote:
You have to be careful with absolute statements:

   > f <- function(pattern) cat("It's legal!")
   > f(pattern != something..)
   It's legal!

"pattern != something.." is a legal expression, which would return a 
logical vector.  My function didn't ever evaluate it, so the fact that 
variables named "pattern" and "something.." didn't exist in the global 
env didn't make any difference.  It's legal syntax, just wrong.

Duncan Murdoch