On 09/09/2010 5:57 AM, Barry Rowlingson wrote:
If I try ls with an unquoted version of something in my search list, I get an error message but the ls completes successfully. For example:> attach("x.RData") > ls(file:x.RData) Error in try(name) : object 'x.RData' not found [1] "x" which seems to be because ls first does: nameValue <- try(name) which raises the error, and then goes on to do some substitute(deparse(magic)) to get the name and carries on as if I'd done ls("file:x.RData") Documentation says (with my enumeration): The ‘name’ argument can specify the environment from which object names are taken in one of several forms: 1. as an integer (the position in the ‘search’ list); 2. as the character string name of an element in the search list; 3. or as an explicit ‘environment’ Either ls(file:x.RData) is none of these in which case there should be an error and exit, or it's (2), in which case the error is misleading. I think try(name,silent=TRUE) might be a better option?
This is old code, so I don't think converting it to an error is a good idea. I don't like the idea of silently eating the error: it might have been a typo, that just coincidentally looks like the name of something on the search list. So I will try to change the error to an informative warning.
Duncan Murdoch ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
