userJT userJT - 1 year ago 118
R Question

R: How can I install a specific release by install_github()?

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

What code can be used to achieve that?

For example for this package

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

The code above is not correct. It only works for branches (e.g., master or devA).
But the devtool package has functions to refer to releases.

Ideally I would refer to releases by their tag (but solution with commit ID would work too).

EXTRA BONUS: What code can install "latest" release. (but consider this a bonus question. The question about is the main one)

Answer Source

You need to append tags for releases directly onto the name of the repository argument. So, username/repo@releasetag will work. Only use the parameter ref = "devA" when you need to refer to a specific branch of the git repository.

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

we have:



After toying around with devtools source, it has come to my attention that one can request the latest source with:


Hence, you could use:


End Edit

Outdated, see edit

Unfortunately, to obtain the latest release tag, the work for that is a bit more complicated as it would involve parsing a response from the GitHub API. Here are some notes if you really do need the tagged version... You would have to parse JSON from:<user>/<repo>/releases/latest

using either RJSONIO, jsonlite, rjson

To extract "tag_name" from:

  "url": "",
  "assets_url": "",
  "upload_url": "{?name,label}",
  "html_url": "",
  "id": 2144150,
  "tag_name": "v1.0.1",
  "target_commitish": "master",
  "name": "Minor bug fix",
  "draft": false,
  "author": {
    "login": "schuemie",
    "id": 6713328,
    "avatar_url": "",
    "gravatar_id": "",
    "url": "",
    "html_url": "",
    "followers_url": "",
    "following_url": "{/other_user}",
    "gists_url": "{/gist_id}",
    "starred_url": "{/owner}{/repo}",
    "subscriptions_url": "",
    "organizations_url": "",
    "repos_url": "",
    "events_url": "{/privacy}",
    "received_events_url": "",
    "type": "User",
    "site_admin": false
  "prerelease": false,
  "created_at": "2015-11-18T00:55:28Z",
  "published_at": "2015-11-18T06:35:57Z",
  "assets": [

  "tarball_url": "",
  "zipball_url": "",
  "body": "Fixed bug in `convertArgsToList ` function."

Above is taken from

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download