knitr 将不再编译:"Error in .First()"
knitr will no longer compile: "Error in .First()"
今天(通过 RStudio)打开 R 时,我在控制台中看到以下红色文本:
Loading required namespace: ffbase
Error in .First() : could not find function "load.ffdf"
这也出现在 base R 中。我今天尝试通过 knitr 编译一个 .rnw
文件(使用 RStudio)并看到以下内容:
Loading required namespace: ffbase
Error in .First() : could not find function "load.ffdf"
Execution halted
我以前从未见过这个问题,.rnw
编译在过去有效,没有任何搜索可以帮助我解决这个问题。
我没有使用 .Rprofile
文件的经验。当我输入 .First
时,我得到以下信息:
> .First
function ()
{
if (!requireNamespace("ffbase")) {
stop("Please install package ffbase, otherwise the files cannot be loaded.")
}
env <- load.ffdf(".", parent.frame())
}
我不确定这是从哪里来的,默认情况下是什么等等。
我通过执行以下操作解决了这个问题。
从 ?.First
.
开始
它在文档中指出:
R searches for a user profile, a file of R code. The path of this file
can be specified by the R_PROFILE_USER
environment variable (and
tilde expansion will be performed). If this is unset, a file called
‘.Rprofile’
is searched for in the current directory or in the
user's home directory (in that order). The user profile file is
sourced into the workspace.
...
Next, if a function .First
is found on the search path, it is
executed as .First()
.
...
For the definition of the ‘home’ directory on Windows see the ‘rw-FAQ
’ Q2.14. It can be found from a running R
by Sys.getenv("R_USER")
.
我在当前目录中没有 .Rprofile
文件,所以我使用 Sys.getenv("R_USER")
引导我进入主目录,其中有一个 .Rprofile
文件,我删除了它,现在错误消失了。
今天(通过 RStudio)打开 R 时,我在控制台中看到以下红色文本:
Loading required namespace: ffbase
Error in .First() : could not find function "load.ffdf"
这也出现在 base R 中。我今天尝试通过 knitr 编译一个 .rnw
文件(使用 RStudio)并看到以下内容:
Loading required namespace: ffbase
Error in .First() : could not find function "load.ffdf"
Execution halted
我以前从未见过这个问题,.rnw
编译在过去有效,没有任何搜索可以帮助我解决这个问题。
我没有使用 .Rprofile
文件的经验。当我输入 .First
时,我得到以下信息:
> .First
function ()
{
if (!requireNamespace("ffbase")) {
stop("Please install package ffbase, otherwise the files cannot be loaded.")
}
env <- load.ffdf(".", parent.frame())
}
我不确定这是从哪里来的,默认情况下是什么等等。
我通过执行以下操作解决了这个问题。
从 ?.First
.
它在文档中指出:
R searches for a user profile, a file of R code. The path of this file can be specified by the
R_PROFILE_USER
environment variable (and tilde expansion will be performed). If this is unset, a file called‘.Rprofile’
is searched for in the current directory or in the user's home directory (in that order). The user profile file is sourced into the workspace....
Next, if a function
.First
is found on the search path, it is executed as.First()
....
For the definition of the ‘home’ directory on Windows see the ‘
rw-FAQ
’ Q2.14. It can be found from a runningR
bySys.getenv("R_USER")
.
我在当前目录中没有 .Rprofile
文件,所以我使用 Sys.getenv("R_USER")
引导我进入主目录,其中有一个 .Rprofile
文件,我删除了它,现在错误消失了。