Answer: The attach() function adds the data frame to the R search path. When a variable name is encountered, data frames in the search path are checked in order to locate the variable.
The detach() function removes the data frame from the search path.detach() does nothing to the data frame itself.
e.g.
attach(mtcars)
summary(mpg)
plot(mpg, disp)
plot(mpg, wt)
detach(mtcars)
Asked In: Many Interviews |
Alert Moderator