For example, in an R session, typing library(ggplot2) and library(\"ggplot2\") can both import the library ggplot2. However, if I type ggplot2 in t
library(ggplot2)
library(\"ggplot2\")
This is how (from the source of library(), which is....long):
library()
package <- as.character(substitute(package))
A simple way to test this yourself:
foo <- function(x) as.character(substitute(x)) > foo(a) [1] "a" > foo("b") [1] "b"