如何从另一个 R 包加载 git 分支 [英] How to load a git branch from another R package

查看:92
本文介绍了如何从另一个 R 包加载 git 分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 R 中,我如何从另一个包加载一个包的 git 分支?

In R, how I load one package's git branch from another package?

有两个包,分别称为producerconsumer1.我通过将一堆函数定义和测试从 producer 移到 consumer1 来重构我的代码.

There are two packages, call them producer and consumer1. I am refactoring my code by moving a bunch of function definitions and tests from producer to consumer1.

我正在为 producerconsumer1 创建 git 分支,rfctrProdrfctrCons1.在 rfctrCons1 中,我需要一个声明做类似的事情

I'm creating git branches, rfctrProd and rfctrCons1 for producer and consumer1. In rfctrCons1, I need a statement doing something like

#` @import producer, gitBranch = rfctrProd

此外,我将对其他导入 producer 的包执行类似的操作,以确保我也没有破坏它们.(我认为我正在重构的函数仅供consumer1使用,但我想在合并更改之前确定.)

Also, I'll to do similarly with other packages which import producer, to make sure I haven't broken them either. (I think the functions I'm refactoring are only used by consumer1, but I want to be sure before I merge my changes.)

推荐答案

您不使用 roxygen 注释来指定导入分支,只使用函数本身.您可以在 Remotes: 下的描述文件中指定分支.假设它是 Github(默认),你可以这样做:

You don't use roxygen comments to specify the import branch, just the functions themselves. You can specify the branch in the DESCRIPTION file, under Remotes:. Assuming it's Github (the default), you can do:

Remotes:
  username/producer/rfctrProd

如果不是 Github,请查看这里 用于其他语法.

If it's not Github, have a look here for the other syntax.

这篇关于如何从另一个 R 包加载 git 分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆