例如,我想这样:
load.this <- "ggplot"
library(load.this)
会报错'package' must be of length 1
。
解决方法是
load.this <- "ggplot"
library(load.this, character.only=TRUE)
# 如果你要返回是否加载成功
library(load.this, character.only=TRUE, logical.return = T)
例如,我想这样:
load.this <- "ggplot"
library(load.this)
会报错'package' must be of length 1
。
解决方法是
load.this <- "ggplot"
library(load.this, character.only=TRUE)
# 如果你要返回是否加载成功
library(load.this, character.only=TRUE, logical.return = T)