From b.rowlingson at lancaster.ac.uk  Thu Sep  9 11:57:46 2010
From: b.rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Thu, 9 Sep 2010 10:57:46 +0100
Subject: [Rd] An ls error which is not an error...
Message-ID: <AANLkTinh9C-+sWLs8Fv9vKmiWP+9O99M7w2gKcGhD4g3@mail.gmail.com>

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?

Barry



[Rd] An ls error which is not an error...
Barry Rowlingson