Explain the 'Attach' and 'Detach' function of 'R' language

 Posted by Niladri.Biswas on 5/1/2013 | Category: Others Interview questions | Views: 2887 | Points: 40
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 

Comments or Responses

Login to post response