how many CRANextra mirror in the world? - r

I have see a setup in someones .Rprofile
options(repos = c(CRAN = "http://streaming.stat.iastate.edu/CRAN",
CRANextra = "http://www.stats.ox.ac.uk/pub/RWin"))
How many CRANextra mirror in the world?
is there only one CRANextra mirror in the world?

The stated reason for offering a bounty is "Looking for an answer drawing from credible and/or official sources."
I would have thought that #JoshuaUlrich is a credible source, but since you're still looking for an answer, I would like to point you to http://stat.ethz.ch/CRAN/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN
At the end of that section of the R-FAQ, there is this paragraph:
Some CRAN packages that do not build out of the box on Windows, require additional software, or are shipping third party libraries for Windows cannot be made available on CRAN in form of a Windows binary packages. Nevertheless, some of these packages are available at the "CRAN extras" repository at http://www.stats.ox.ac.uk/pub/RWin/ kindly provided by Brian D. Ripley. Note that this repository is a default repository for recent versions of R for Windows.
While it doesn't explicitly state that this is the only "CRAN extras" repository, as it receives special mention on the official help page for the Comprehensive R Archive Network, in the section that describes the add-on packages from CRAN, I think this can be treated as an official source justifying Joshua's comment.

I think Joshua is right, but if you have a project you are working on from multiple machines, you might consider setting up your own as this asker did.
local({r <- getOption("repos");
r["CRANextra"] <- "pathtoCRANextraBasedir/"
options(repos=r)})

Related

DWmR pacakge in r [duplicate]

I want to use some packages, but they has been deleted in CRAN, though their formerly available versions can be obtained from the archive. Those packages are not in r-forge, too.
For instance, dynamo and gafit.
Though those packages have been removed, I find them still useful and can help me.
Is it possible to and how to install them easily? like one_line_install('http://sss.tar.gz').
By the way, I may use them in Windows and/or in OS X. So the code should be designed as "multi-platform".
It is easy using the devtools package as there is no need to download the package yourself. For example:
library(devtools)
install_url('http://cran.r-project.org/src/contrib/Archive/dynamo/dynamo_0.1.3.tar.gz')
install_url('http://cran.r-project.org/src/contrib/Archive/gafit/gafit_0.4.tar.gz')
I have no doubt this will be platform-independent.
The package has other related and useful functions such as install_version, install_local, install_github, etc.
Depending on how far back you want to go, you can also use the MRAN snapshot archive. This is a sequence of daily snapshots of CRAN, going back to September 2014.
Eg to install a package from CRAN as it was on 30 June 2015:
install.package("my_package",
repos="https://mran.microsoft.com/snapshot/2015-06-30")
Try
install.packages('/path/dynamo_0.1.3.tar.gz', type = 'source')
where path is the path to the file you downloaded. That is it on a Mac! On Windows you have to play a bit with the slashes :-)
For what it's worth, package gafit is available again without resorting to tricks.
As suggested above it was broken for some years as the core R system changed some packaging conventions. Hopefully fully fixed now.

If I want to upper version for a CRAN exist R package (from 0.2.0 to 0.2.1) , do I need to delete "CRAN-RELEASE" in R package?

I find that there is a CRAN-RELEASE file inside package after I first time release the package.
It said "This package was submitted to CRAN on 2020-07-25.
Once it is accepted, delete this file and tag the release (commit ...)."
Since I already has version 0.2.0 for the package on CRAN, but do need to release up-version later (e.g. 0.2.1) on CRAN, do I need to keep that CRAN-RELEASE file or should I delete it? Will it affect anything?
Also, what is the second half sentence means "tag the release (commit ...)". Is that means I need to do something such as
I also wondered about the phrase "tag the release", but then I found section 20.7 of Wickham and Bryan's R-packages book, and it became clear.
For reference: there it says this (let's let a 'couple' mean 'three' ;-) )
Once your package has been accepted by CRAN, you have a couple of technical tasks to do:
If you use GitHub, go to the repository release page. Create a new release with tag version v1.2.3 (i.e. “v” followed by the version of your package). Copy and paste the contents of the relevant NEWS.md section into the release notes.
If you use git, but not GitHub, tag the release with git tag -a v1.2.3.
Add the .9000 suffix to the Version field in the DESCRIPTION to indicate that this is a development version. Create a new heading in NEWS.md and commit the changes.

Virtual environment in R?

I've found several posts about best practice, reproducibility and workflow in R, for example:
How to increase longer term reproducibility of research (particularly using R and Sweave)
Complete substantive examples of reproducible research using R
One of the major preoccupations is ensuring portability of code, in the sense that moving it to a new machine (possibly running a different OS) is relatively straightforward and gives the same results.
Coming from a Python background, I'm used to the concept of a virtual environment. When coupled with a simple list of required packages, this goes some way to ensuring that the installed packages and libraries are available on any machine without too much fuss. Sure, it's no guarantee - different OSes have their own foibles and peculiarities - but it gets you 95% of the way there.
Does such a thing exist within R? Even if it's not as sophisticated. For example simply maintaining a plain text list of required packages and a script that will install any that are missing?
I'm about to start using R in earnest for the first time, probably in conjunction with Sweave, and would ideally like to start in the best way possible! Thanks for your thoughts.
I'm going to use the comment posted by #cboettig in order to resolve this question.
Packrat
Packrat is a dependency management system for R. Gives you three important advantages (all of them focused in your portability needs)
Isolated : Installing a new or updated package for one project won’t break your other projects, and vice versa. That’s because packrat gives each project its own private package library.
Portable: Easily transport your projects from one computer to another, even across different platforms. Packrat makes it easy to install the packages your project depends on.
Reproducible: Packrat records the exact package versions you depend on, and ensures those exact versions are the ones that get installed wherever you go.
What's next?
Walkthrough guide: http://rstudio.github.io/packrat/walkthrough.html
Most common commands: http://rstudio.github.io/packrat/commands.html
Using Packrat with RStudio: http://rstudio.github.io/packrat/rstudio.html
Limitations and caveats: http://rstudio.github.io/packrat/limitations.html
Update: Packrat has been soft-deprecated and is now superseded by renv, so you might want to check this package instead.
The Anaconda package manager conda supports creating R environments.
conda create -n r-environment r-essentials r-base
conda activate r-environment
I have had a great experience using conda to maintain different Python installations, both user specific and several versions for the same user. I have tested R with conda and the jupyter-notebook and it works great. At least for my needs, which includes RNA-sequencing analyses using the DEseq2 and related packages, as well as data.table and dplyr. There are many bioconductor packages available in conda via bioconda and according to the comments on this SO question, it seems like install.packages() might work as well.
It looks like there is another option from RStudio devs, renv. It's available on CRAN and supersedes Packrat.
In short, you use renv::init() to initialize your project library, and use renv::snapshot() / renv::restore() to save and load the state of your library.
I prefer this option to conda r-enviroments because here everything is stored in the file renv.lock, which can be committed to a Git repo and distributed to the team.
To add to this:
Note:
1. Have Anaconda installed already
2. Assumed your working directory is "C:"
To create desired environment -> "r_environment_name"
C:\>conda create -n "r_environment_name" r-essentials r-base
To see available environments
C:\>conda info --envs
.
..
...
To activate environment
C:\>conda activate "r_environment_name"
(r_environment_name) C:\>
Launch Jupyter Notebook and let the party begins
(r_environment_name) C:\> jupyter notebook
For a similar "requirements.txt", perhaps this link will help -> Is there something like requirements.txt for R?
Check out roveR, the R container management solution. For details, see https://www.slideshare.net/DavidKunFF/ownr-technical-introduction, in particular slide 12.
To install roveR, execute the following command in R:
install.packages("rover", repos = c("https://lair.functionalfinances.com/repos/shared", "https://lair.functionalfinances.com/repos/cran"))
To make full use of the power of roveR (including installing specific versions of packages for reproducibility), you will need access to a laiR - for CRAN, you can use our laiR instance at https://lair.ownr.io, for uploading your own packages and sharing them with your organization you will need a laiR license. You can contact us on the email address in the presentation linked above.

'Malformed' Error on R package check with --as-cran. Package built with Rstudio

A few months ago I launched the 'table1xls' package, built using Rstudio. Since then some revisions have naturally accumulated. I wanted to share the revisions on CRAN in time for the R 3.1.0 rollout.
The problem is, for a couple of months now the --as-cran check option is giving me this annoying error:
* checking CRAN incoming feasibility ...Error: Line starting '<HTML><HEAD><TITLE>C ...' is malformed!
Now, I have no HTML in my package, nor any files that compile into HTML format. My work desktop (where this error occurs) is behind a firewall that requires the --internet2 flag when launching R, but Rstudio seems generally unfazed by that.
I saw this question pop up here and there, including on Rstudio's support pages where it remains unanswered. Any insight will be gratefully accepted.
Btw, my package is available on GitHub, user name "AssafOron". I wonder whether users can install it directly via devtools::install_github.
Oh, forgot to add: I'm using Windows (it's still XP over here) and this error is on the 3.1.0 alpha. But the same error was present with 3.0.2 as well. My top 2 suspects are something with Rstudio, or the firewall.
That looks very much like a proxy issue.
A simple fix: upload the package to win-builder where you can test against the released version of R as well as the development version. If they do not flag anything ... then you know you;re good.
Else, go to a local Starbucks or public library and use different connectivity.

showing vignettes link upon building and reloading an R package

I have created a vigentte folder for an R package I am developing by running the code devtools::use_vignette("my-vignette"). I am using Rmarkdown and knitr packages.
When I build & reload the package, I don't get a hyperlink for the title of the Rmarkdown file (which contains the long-form documentation of the package) in the documentation page of the package. I do get hyperlinks for the DESCRIPTION file of the package as well as the help pages of the documented functions but not the hyperlink that should direct people to the Rmarkdown document. I am wondering why and what should I do to get a hperlink for the long-form documentation of the package in a similar way that I get it for the help pages for the functions used in the package?
Daragh,
Can you provide more detail on the error you are seeing? If the code is posted on github or you have a specific error then we may be able to help further - if not then the best advice I can give is to check out Hadley Wickam's "R Packages" book online - it is a great reference:
http://r-pkgs.had.co.nz/
that will at least give you a good sense of how to build the vignettes.
http://r-pkgs.had.co.nz/vignettes.html
From the online book by Hadley Wickham referenced above...
CRAN notes
Note that since you build vignettes locally, CRAN only receives the html/pdf and the source code. However, CRAN does not re-build the vignette. It only checks that the code is runnable (by running it). This means that any packages used by the vignette must be declared in the DESCRIPTION. But this also means that you can use Rmarkdown (which uses pandoc) even though CRAN doesn’t have pandoc installed.
Common problems:
The vignette builds interactively, but when checking, it fails with an error about a missing package that you know is installed. This means that you’ve forgotten to declare that dependency in the DESCRIPTION (usually it should go in Suggests).
Everything works interactively, but the vignette doesn’t show up after you’ve installed the package. One of the following may have occurred. First, because RStudio’s “build and reload” doesn’t build vignettes, you may need to run devtools::install() instead. Next check:
The directory is called vignettes/ and not vignette/.
Check that you haven’t inadvertently excluded the vignettes with .Rbuildignore
Ensure you have the necessary vignette metadata.
If you use error = TRUE, you must use purl = FALSE.
You’ll need to watch the file size. If you include a lot of graphics, it’s easy to create a very large file. There are no hard and fast rules, but if you have a very large vignette be prepared to either justify the file size, or to make it smaller.

Resources