使用 install_github 在分支上安装包时出错

Emi*_*una 2 installation github devtools

我已经从 github 分叉了一个包并做了一些更改。我正在尝试安装已使用 install_github() 进行更改的软件包版本,但收到错误消息。有什么建议么?

\n\n

分叉版本: https: //github.com/embruna/refnet

\n\n

分支上编辑后的版本:https ://github.com/embruna/refnet/tree/proposed-updates

\n\n

我可以使用以下命令安装分叉版本:

\n\n
install_github("embruna/refnet", subdir="pkg")\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试使用以下命令在分支上安装该版本:

\n\n
install_github("embruna/refnet@proposed-updates", subdir="pkg")\n
Run Code Online (Sandbox Code Playgroud)\n\n

但随后出现此错误:

\n\n
** help\n*** installing help indices\n** building package indices\nError in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : \n    line 1 did not have 6 elements\nERROR: installing package indices failed\n* removing \xe2\x80\x98/Library/Frameworks/R.framework/Versions/3.3/Resources/library/refnet\xe2\x80\x99\nError: Command failed (1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

感谢您的任何建议。

\n\n

编辑:有两个问题:1)我使用的 install_github 语法不正确,2)“pkg”中有一个文件夹即使在更正语法后也会抛出错误。详情请参阅下文。

\n

Ben*_*ker 5

我猜想用参数指定分支@但使用子目录subdir会令人困惑devtools

这对我有用(在参数中指定子目录和分支repo):

install_github("embruna/refnet/pkg@proposed-updates",
Run Code Online (Sandbox Code Playgroud)

这也是如此(将分支和子目录指定为单独的参数):

devtools::install_github("embruna/refnet",
           ref = "proposed-updates", subdir = "pkg")
Run Code Online (Sandbox Code Playgroud)

输出以这种方式开始...

Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo embruna/refnet@proposed-updates
from URL https://api.github.com/repos/embruna/refnet/zipball/proposed-updates
Installing refnet
Run Code Online (Sandbox Code Playgroud)

这是使用 devtools 1.12.0