rattach: Smart alternative to 'attach'

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/rattach.R

Description

Checks if object of the same name is already attached and detaches it. Also checks for objects in .GlobalEnv which will mask items in the attachment.

Usage

1
rattach(db, pos = 2, overwrite = NA, ...)

Arguments

db

Name of object to attach

pos

Where in the search list to insert

overwrite

If TRUE, objects in .GlobalEnv which would mask items in db are deleted. If NA, a dialogue box pops up for the user to decide whether to delete them or not.

...

Additional arguments passed to attach.

Details

See help on attach for more details

Value

Nothing of interest, used for its side effect.

Author(s)

Mike Meredith, 23 Sept 08, inspired by features of R2WinBUGS::attach.bugs

See Also

See also attach.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(trees)
names(trees)
rattach(trees)
Girth
## trees$Girth is actually the diameter in inches;
## correct it:
trees$Girth <- Girth * pi
Girth	# still the old values
rattach(trees)
Girth	# now the corrected values
detach(trees)

mikemeredith/MMmisc documentation built on Nov. 8, 2019, 11:34 p.m.