Sometimes updated functions are not downloaded when using R package from GitHub - r

I am publishing an R package to GitHub (IDOJI/refineR).
I use Github desktop to update the package.
If I modify some functions, then I always update my repo.
And it works well so that I can find my functions have been updated on my Github.
However, sometimes some updated functions are not downloaded from my repo.
More specifically, the downloaded function is not an updated version.
I use this line to download the package.
devtools::install_github("IDOJI/refineR", force=T)
Do you have any ideas?

Related

Download R package from github as tar.gz

I need to have the tar.gz build version of a package from git.
The git link would look like
devtools::install_github('repo/package#x.1.0')
Let's assume it is
devtools::install_github("tidyverse/lubridate") but instead of installing I need the actual file so I can install it in in an offline container at some point.
The package I need is not on CRAN, on git only, and I need a specific version of the release, not the latest.
I tried to run a different download.file arguments, no success.

Using a forked and modified version of R GitHub repo

I have forked a GitHub repo of an R library and edited some functionalities as per my requirements. I now want to use this new library and its functions in my R script. Is there a way to do this?
I read this https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html
For ex:
I have forked and edited the repo package textshaping and I want to use this newly edited version something like:
library(username/textshaping)
username/textshaping::text_width("Seven sea\'s seacod")

Make CRAN R package suggest GitHub R package

I want to use the R package BOLTSSIRR available on GitHub in my R package, which I want to upload to CRAN.
I listed BOLTSSIRR under Suggests: in the DESCRIPTION file and made the link to GitHub available using Additional_repositories: https://github.com/daviddaigithub/BOLTSSIRR.
However, running R CMD check --as-cran I get:
Suggests or Enhances not in mainstream repositories:
BOLTSSIRR
Availability using Additional_repositories specification:
BOLTSSIRR no ?
? ? https://github.com/daviddaigithub/BOLTSSIRR
Additional repositories with no packages:
https://github.com/daviddaigithub/BOLTSSIRR
So the GitHub link does not seem to get recognized in the check. Might I have to change something here?
As you found, you can't use Remotes in a CRAN package. What you need to do is to make sure the .tar.gz file for the package you are depending on is available somewhere. Github doesn't do that automatically, because https://github.com/daviddaigithub/BOLTSSIRR isn't set up as a package repository.
The solution is to create your own small repository, and keep copies of non-CRAN packages there. The drat package (available here: https://github.com/eddelbuettel/drat) makes this easy as long as you have a Github account: follow the instructions here: https://github.com/drat-base/drat. In summary:
Fork https://github.com/drat-base/drat into your account, and clone it to your own computer.
Enable Github Pages with the docs/ folder in the main branch.
Install the drat package into R using remotes::install_github("eddelbuettel/drat"). (I assume this version will make it to CRAN eventually; if you use the current CRAN version instructions are slightly more complicated.)
Build the package you want to insert. You need the source version; you might want binaries too, if those are hard for your users to build.
Run options(dratBranch="docs"); drat::insertPackage(...) to insert those files into your repository.
Commit the changes, and push them to Github.
In the package that needs to use this non-CRAN package, add
Additional_repositories: https://yourname.github.io/drat
to the DESCRIPTION.
You will be responsible for updating your repository if BOLTSSIRR is updated. This is good because the updates might break yours: after all, it's still in development mode. It's also bad because your users won't automatically get bug fixes.
That's it, if I haven't missed anything!

Install specific package version in Microsoft R Open

How do I install a specific package version in Microsoft R Open (MRO)? I am familiar with the checkpoint("YYYY-MM-DD") function for changing ALL package versions to a specific MRO snapshot. I do not want to do this. I only want to change the version of a single package.
To install a specific version of a package, download the package from the CRAN or MRAN archive (src/contrib/Archive) and install it with
install.packages("/path/to/pkg/src", type="source")
where/path/to/pkg/src is the path to the downloaded package.
To get the package directly from a specific MRAN snapshot, use
install.packages('pkg', repos='https://mran.microsoft.com/snapshot/YYYY-MM-DD/')
To also get the dependencies, you want
install.packages('pkg', repos='https://mran.microsoft.com/snapshot/YYYY-MM-DD/', dependencies=TRUE)
Be aware, however, that the version you choose may not be compatible with the version of MRO you are using. This is why MRO uses a specific MRAN snapshot--to ensure compatibility of available packages with the specific MRO.
I'm not too familiar with the checkpoint() function but what I do see is that you can set project to a directory of packages you want to project be installed from the MRAN snapshot for the date specified for snapshotDate. It defaults to current working directory using getwd(), so I would assume if you changed the directory and had a specific package there, you would be able to workaround that way.

Install R packages from github downloading master.zip

I probably have some issues in my connectivity (some sort of blocks, I don't know) and I can't install directly form gitHub
> install_github("assertthat")
Installing github repo(s) assertthat/master from hadley
Installing assertthat.zip from https://github.com/hadley/assertthat/archive/master.zip
I tried with lots of other packages, same result. However, I am able to download master.zip form the browser. Can you tell if it's possible install directly the .zip? thanks.
This answer is just a refined version of my comments. Essentially you can install packages using devtools by unzipping a local zipfile downloaded from github, and then running the install function
install("path/to/unzipped_pkg_zip_file")
The latest dev version of devtools contains an install_local utility function that makes it easy to work directly with local zip files.

Resources