Report Masked S-PLUS Objects

DESCRIPTION:
Reports objects with common names on different databases.

USAGE:
masked(where=1)
Splus MASKED [directory]

OPTIONAL ARGUMENTS:
where:
for the function masked only, a number or a character string specifying a database to search for masking objects. A positive number refers to the corresponding element of the search list. where=0 means database zero. A character string is interpreted as the name of a database on the current search list. Names are as returned by the search function. The default for where is the working database.
directory:
for the utility MASKED only, the name of a directory to search for masking objects. The default is the first writeable directory named in environment variable S_WORK; this is the same mechanism S-PLUS uses to determine which directory to attach at search position 1, the working database.

VALUE:
masked returns a character vector of object names which are common to both the specified database and some database behind it on the search list (from where + 1 to length(search())). This includes currently attached directory databases, recursive S-PLUS objects, and (dictionaried) user-defined databases.

The utility MASKED prints, on the standard output, object names which are common to both the specified directory and some directory named in S_PATH.

In both cases, object modes are ignored.


DETAILS:
When S-PLUS searches for an object (function or dataset), it examines the current frame, the session frame, database zero, and each of the databases on the search list, in that order. If an object of unspecified mode is being sought, the first successful name match will terminate the search. If the search is mode-specific, it ends when both criteria are satisfied. Any objects with the same name (or name and mode) on later databases are said to be masked.

A search for masked objects is useful when S-PLUS functions and datasets do not appear to behave as they should. In extreme cases it may not even be possible to start S-PLUS because some critical function is masked (a function used in .First, for instance); in this case use the utility MASKED from the shell.


NOTE:
Although masked does not call any further functions, and is therefore not sensitive to masked functions itself, it may not be possible to print the answer if any function involved in printing has been masked. If this appears to be the case, try cat(masked(), "\n"), since cat does not call any functions.

SEE ALSO:
conflicts , exists , find , get , objects , search .

EXAMPLES:
  c <- function(...) cat("My c function called.\n")
        # now system function c is masked
Warning messages:
  assigning "c" masks an object of the same name on database 4
  c(1,2,3)         # will find the new c, not the system c
My c function called.
  masked()
[1] "c"
  remove("c")
  length <- function(...) stop("system length function masked")
        # now system function length is masked
Warning messages:
  assigning "length" masks an object of the same name on database 4
  masked()      # cannot print the answer
Error in length(class(x)): system length function masked
  cat(masked(), "\n")   # cat calls no further functions
length
 remove("length")
% Splus MASKED my_funs_dir       # check working directory 'my_funs_dir'