Dear HelpeRs,
I'm confused about the role of quotes around package names on the
library and detach functions. Books on R use both approaches:
library(Hmisc)
describe(mydata)
detach(package:Hmisc)
and
library("Hmisc")
describe(mydata)
detach("package:Hmisc")
The help file for detach says "quoted or unquoted" and the help file for
library says about the package, "the name of a package, given as a name
or literal character string, or a character string, depending on whether
character.only is FALSE (default) or TRUE)."
Are there conditions under which it matters? Which is best?
Thanks,
Bob
=========================================================
Bob Muenchen (pronounced Min'-chen),
Manager, Statistical Consulting Center
U of TN Office of Information Technology
Stokely Management Center, Suite 200
916 Volunteer Blvd., Knoxville, TN 37996-0520
Voice: (865) 974-5230
FAX: (865) 974-4810
Email: muenchen at utk.edu
Web: http://oit.utk.edu/scc
Map: http://www.utk.edu/maps
News: http://listserv.utk.edu/archives/statnews.html
=========================================================
When to quote a package name
2 messages · Muenchen, Robert A (Bob), Uwe Ligges
Muenchen, Robert A (Bob) wrote:
Dear HelpeRs,
I'm confused about the role of quotes around package names on the
library and detach functions. Books on R use both approaches:
library(Hmisc)
describe(mydata)
detach(package:Hmisc)
and
library("Hmisc")
describe(mydata)
detach("package:Hmisc")
The help file for detach says "quoted or unquoted" and the help file for
library says about the package, "the name of a package, given as a name
or literal character string, or a character string, depending on whether
character.only is FALSE (default) or TRUE)."
Are there conditions under which it matters? Which is best?
The cleaner approach is to use quotes. I'd expect x <- "Hmisc" library(x) to install package "Hmisc", but not package "x"... In fact, it also installs "x" (as documented), unfortunately. Uwe Ligges
Thanks, Bob ========================================================= Bob Muenchen (pronounced Min'-chen), Manager, Statistical Consulting Center U of TN Office of Information Technology Stokely Management Center, Suite 200 916 Volunteer Blvd., Knoxville, TN 37996-0520 Voice: (865) 974-5230 FAX: (865) 974-4810 Email: muenchen at utk.edu Web: http://oit.utk.edu/scc Map: http://www.utk.edu/maps News: http://listserv.utk.edu/archives/statnews.html =========================================================
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.