database.status
and
database.attr
can also be used to
change the status or an attribute of an attached database.
database.object(where, meta=0) database.type(where, meta=0) database.status(where, meta=0) database.status(where, meta=0) <- value database.attr(which, where=1:length(search()), meta=0) database.attr(which, where, meta=0) <- value
database.attr
,
where
is a vector of database
positions that are searched in turn for the requested attribute.
Further, if
database.attr
is being used to find the value of an
attribute, it will search the entire string if
where
is not specified.
"methods"
or
"help"
, report or modify
information in the corresponding meta-database instead of the ordinary
datbase.
database.object
returns the actual object attached
in the
where
th position of the search list.
database.type
returns a character string describing
the type of database at the
where
position in the search list:
"directory"
, an ordinary directory containing S-PLUS objects;
"object"
, a S-PLUS object (list);
"compiled"
, a compiled object (see function
cdump
);
"user"
, a user-defined database (see
dbread
).
database.status
returns a character string giving
the status of a database:
"read"
, a read-only database;
"readwrite"
, a database that can be read and modified;
"modified"
, a database that has been modified since it was
attach
ed.
database.attr
returns the value of the attribute named
which
corresponding to the first database position in
where
that has such an attribute
(or
NULL
if the attribute does not exist).
database.status
can change
the status of a database to
value
database.attr
changes the
attribute named
what
corresponding to the first database position in
where
to
value
.
A permanent, recursive S-PLUS object (typically an expression or a list) can be attached as an element in the search list. The elements of the object become available as separate named objects, referenced by the corresponding elements of the names attribute of the attached recursive object. These databases can be used just like any other S-PLUS database: data access, assignment and modification should take place normally. The potential advantages of using S-PLUS objects as databases are that they make access of objects faster, and that they retain their identity as S-PLUS objects so that a variety of programming techniques become available for them, including the use of methods.
a <- scan("mydata",list(name="",salary=1,age=1,dept="")) attach(a) # now the elements available by name name[salary>100000]