R: How can I install a specific version of install_github ()?

Devtools is a great package. If the current version of the package gives some errors, users may prefer to install a specific version (for example, version 1.0.1).

What code can be used to achieve this?

For example, for this package https://github.com/OHDSI/OhdsiRTools/tree/v1.0.1

A command like install_github ("OHDSI / OhdsiRTools", ref = 'v1.0.1')

Invalid code. It only works for branches (e.g. master or devA). But the devtool package has functions for linking to releases.

Ideally, I would like to refer to releases by their tag (but a solution with a commit identifier will work too).

ADDITIONAL BONUS: Which code can install the "latest" version. (but consider this a bonus question. The question is whether the main one)

+4
source share
1 answer

You need to add tags for releases directly to the repository argument name. So it username/repo@releasetagwill work. Use only the option ref = "devA"when you need to access a specific git repository branch.

For your example, regarding OhdsiRTools v1.0.1 , we have

we have:

devtools::install_github("OHDSI/OhdsiRTools@v1.0.1")

Edit

After visiting the source, devtoolsI was curious that you can request the last source using

username/repo@*release

Therefore, you can use:

devtools::install_github("OHDSI/OhdsiRTools@*release")

Edit end

Deprecated, see edit

, , API GitHub. , ... JSON :

https://api.github.com/repos/<user>/<repo>/releases/latest

RJSONIO, jsonlite, rjson

"tag_name" :

{
  "url": "https://api.github.com/repos/OHDSI/OhdsiRTools/releases/2144150",
  "assets_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/releases/2144150/assets",
  "upload_url": "https://uploads.github.com/repos/OHDSI/OhdsiRTools/releases/2144150/assets{?name,label}",
  "html_url": "https://github.com/OHDSI/OhdsiRTools/releases/tag/v1.0.1",
  "id": 2144150,
  "tag_name": "v1.0.1",
  "target_commitish": "master",
  "name": "Minor bug fix",
  "draft": false,
  "author": {
    "login": "schuemie",
    "id": 6713328,
    "avatar_url": "https://avatars.githubusercontent.com/u/6713328?v=3",
    "gravatar_id": "",
    "url": "https://api.github.com/users/schuemie",
    "html_url": "https://github.com/schuemie",
    "followers_url": "https://api.github.com/users/schuemie/followers",
    "following_url": "https://api.github.com/users/schuemie/following{/other_user}",
    "gists_url": "https://api.github.com/users/schuemie/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/schuemie/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/schuemie/subscriptions",
    "organizations_url": "https://api.github.com/users/schuemie/orgs",
    "repos_url": "https://api.github.com/users/schuemie/repos",
    "events_url": "https://api.github.com/users/schuemie/events{/privacy}",
    "received_events_url": "https://api.github.com/users/schuemie/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": false,
  "created_at": "2015-11-18T00:55:28Z",
  "published_at": "2015-11-18T06:35:57Z",
  "assets": [

  ],
  "tarball_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/tarball/v1.0.1",
  "zipball_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/zipball/v1.0.1",
  "body": "Fixed bug in `convertArgsToList ` function."
}

https://api.github.com/repos/OHDSI/OhdsiRTools/releases/latest

+6

Source: https://habr.com/ru/post/1658462/


All Articles