Displaying 1 result from an estimated 1 matches for "attach_and_detach".
2007 May 16
0
attach/detach asymmetry
.... Surprise number 3.
This is all documented behaviour (actually, I cant find any 
documentation on the 'file:' prefixing), but am I the only person who 
finds it inelegant? Or even downright ugly that the help page for 
detach() gives this example code for attaching and detaching by name?
attach_and_detach <- function(db, pos=2)
      {
         name <- deparse(substitute(db))
         attach(db, pos=pos, name=name)
         print(search()[pos])
         eval(substitute(detach(n), list(n=name)))
      }
  - and that doesn't work for attached data files because of the 'file:' 
prefi...