R: package vignette not built - r

Problem
I created a small internal package for my company. To describe hot to use it, I wrote a vignette. But for some reason, the vignette is not built when I hit Install and Restart in RStudio.
Further Information
I use roxygen for the package documentation
Interestingly, the output from Install and Restart says that it is installed:
==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
Updating DataReportR documentation
Loading DataReportR
Documentation completed
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source DataReportR
* installing to library 'C:/Program Files/R/library'
* installing *source* package 'DataReportR' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (DataReportR)
devtools::build_vignettes() returns NULL even though the lines
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
are included in the DESCRIPTION.
The YAML header of the vignette looks like this:
---
title: "My title"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Generate LaTeX tables for Data Reports}
%\VignetteEngine{rmarkdown::render}
%\usepackage[utf8]{inputenc}
---
I also tried to force building the vignette by devtools::build(vignettes = TRUE) but nothing changed.
EDIT (changed YAML header):
When I change %\VignetteEngine{rmarkdown::render} to %\VignetteEngine{knitr::rmarkdown} in the vignette's YAML header, devtools::build_vignettes() works and places the built vignette in /inst/doc/.
However, when I Check the package in RStudio, the check fails at this position:
** installing vignettes
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
undefined exports: create_var_details, create_var_overview
Error: loading failed
Execution halted
ERROR: loading failed
Both create_var_details and create_var_overview are exported functions. Here an example:
...
#' #export
#'
create_var_details <- function(...
...
With the old header, the checks were fine.

I figured out that R did not find pandoc. Thus, I added the pandoc path to the PATH environment variable. I also changed the vignette enginge to %\VignetteEngine{knitr::rmarkdown} as suggested in the comments by #R18.
Now the vignette is properly built when I click on Install and Restart in RStudio.
However, checking the package still does not work. See my EDIT to the question. But this in another question: R package: Adding a vignette causes 'undefined exports'

Related

Building my unaltered package suddenly fails: for Vignettes and 'arch = x64'

Context
I've been developing a proprietary package (call it "my_pkg") with vignettes, in RStudio with the latest version (4.1.1) of R. I'm working on a Lenovo ThinkPad with the following software
sysname release version machine
"Windows" "10 x64" "build 19043" "x86-64"
as provided by Sys.info().
Until recently, my devtools workflow has been reasonably smooth (with one occasional exception). However, I've begun to encounter a very puzzling error, which occurs under conditions virtually identical to those beforehand, when the workflow proceeded without issue.
Despite the fact that my vignettes always built successfully before, and I have not edited them in the meantime, the build now fails for architecturally specific reasons...
Error : package 'my_pkg' is not installed for 'arch = x64'
...when and only when I include the vignettes in the build.
I have reinstalled R (and Rtools and RStudio) from scratch, reinstalled devtools (and its dependencies), and "rewound" my project to the last Git commit at which devtools::check() succeeded. I have also walked through extensive troubleshooting with responders like #SteffenMoritz and #Alexis, for whom I have appended further information in the section Info by Request.
Unfortunately, nothing has worked.
Failure With devtools::check()
When I run devtools::check(), everything starts promisingly...
i Updating my_pkg documentation
i Loading my_pkg
Writing NAMESPACE
Writing NAMESPACE
-- Building --------------------------------------------------------------------------------- my_pkg --
Setting env vars:
* CFLAGS : -Wall -pedantic
* CXXFLAGS : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
-------------------------------------------------------------------------------------------------------
√ checking for file 'C:\Users\greg\Workspace\R\Packages\my_pkg/DESCRIPTION' ...
- preparing 'my_pkg': (733ms)
√ checking DESCRIPTION meta-information ...
- installing the package to build vignettes
-----------------------------------
- installing *source* package 'my_pkg' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'my_pkg'
finding HTML links ... done
foo html
my_pkg-package html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
...until the step testing if installed package can be loaded from temporary location. Here an error occurs:
Error : package 'my_pkg' is not installed for 'arch = x64'
Error: loading failed
Execution halted
ERROR: loading failed
- removing 'C:/Users/greg/AppData/Local/Temp/RtmpSaabgx/Rinst332419517258/my_pkg'
-----------------------------------
ERROR: package installation failed
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> ** building package indices
E> ** installing vignettes
E> ** testing if installed package can be loaded from temporary location
E> Error : package 'my_pkg' is not installed for 'arch = x64'
E> Error: loading failed
E> Execution halted
E> ERROR: loading failed
E> * removing 'C:/Users/greg/AppData/Local/Temp/RtmpSaabgx/Rinst332419517258/my_pkg'
E> -----------------------------------
E> ERROR: package installation failed
Type .Last.error.trace to see where the error occurred
The .Last.error.trace suggests an issue with pkgbuild specifically:
> .Last.error.trace
Stack trace:
1. devtools::check()
2. withr::with_envvar(pkgbuild::compiler_flags(FALSE), action = "prefix", ...
3. base:::force(code)
4. pkgbuild::build(pkg$path, tempdir(), args = build_args, quiet = quiet, ...
5. withr::with_temp_libpaths(rcmd_build_tools(options$cmd, c(options$path, ...
6. base:::force(code)
7. pkgbuild:::rcmd_build_tools(options$cmd, c(options$path, options$args), ...
8. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env, ...
9. withr::with_path(rtools_path(), code)
10. base:::force(code)
11. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, ...
12. callr:::run_r(options)
13. base:::with(options, with_envvar(env, do.call(processx::run, ...
14. base:::with.default(options, with_envvar(env, do.call(processx::run, ...
15. base:::eval(substitute(expr), data, enclos = parent.frame())
16. base:::eval(substitute(expr), data, enclos = parent.frame())
17. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, ...
18. base:::force(code)
19. base:::do.call(processx::run, c(list(bin, args = real_cmdargs, ...
20. (function (command = NULL, args = character(), error_on_status = TRUE, ...
21. throw(new_process_error(res, call = sys.call(), echo = echo, ...
I have no clue as to why the architecture
Error : package 'my_pkg' is not installed for 'arch = x64'
should be an issue only now. There have been no substantive changes to my computer.
Despite the message package installation failed, and despite the fact that I've run devtools::check() rather than devtools::install(), the package acts as if it were "halfway" installed! I can type my_p in the console, and RStudio will autocomplete my_pkg; and I can then type my_pkg:: and RStudio will supply the standard autocompletion list of the functions in my_pkg, which are all available.
However, typing my_pkg:: not only summons the #exported functions but also exposes my internal functions and data, as if I had typed my_pkg:::!
Success With devtools::install() or devtools::build(vignettes = FALSE)
Oddly, when I actually run devtools::install(), or comparably devtools::build_vignettes(vignettes = FALSE), the process completes without a hitch!
√ checking for file 'C:\Users\greg\Workspace\R\Packages\my_pkg/DESCRIPTION' ...
- preparing 'my_pkg': (640ms)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts (384ms)
- checking for empty or unneeded directories
Removed empty directory 'my_pkg/inst/libs'
Omitted 'LazyData' from DESCRIPTION
- building 'my_pkg_0.0.0.9000.tar.gz'
Running "C:/Users/greg/R/bin/x64/Rcmd.exe" INSTALL \
"C:\Users\greg\AppData\Local\Temp\Rtmpozvh26/my_pkg_0.0.0.9000.tar.gz" --install-tests
* installing to library 'C:/Users/greg/R/library'
* installing *source* package 'my_pkg' ...
** using staged installation
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'my_pkg'
finding HTML links ... done
foo html
my_pkg-package html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (my_pkg)
Making 'packages.html' ... done
Now, the autocompletion works entirely as expected, and only the appropriate functions are exposed by my_pkg:: and my_pkg::: respectively.
Failure With devtools::install(build_vignettes = TRUE) or devtools::build()
Yet there is one further plot twist. When I use devtools::install(build_vignettes = TRUE), or comparably devtools::build(), I get a similar error to that with devtools::check():
√ checking for file 'C:\Users\greg\Workspace\R\Packages\my_pkg/DESCRIPTION' ...
- preparing 'my_pkg': (672ms)
√ checking DESCRIPTION meta-information ...
- installing the package to build vignettes
-----------------------------------
- installing *source* package 'my_pkg' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'my_pkg'
finding HTML links ... done
foo html
my_pkg-package html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error : package 'my_pkg' is not installed for 'arch = x64'
Error: loading failed
Execution halted
ERROR: loading failed
- removing 'C:/Users/greg/AppData/Local/Temp/RtmpM7RbHr/Rinst504119422cd/my_pkg'
-----------------------------------
ERROR: package installation failed
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> ** building package indices
E> ** installing vignettes
E> ** testing if installed package can be loaded from temporary location
E> Error : package 'my_pkg' is not installed for 'arch = x64'
E> Error: loading failed
E> Execution halted
E> ERROR: loading failed
E> * removing 'C:/Users/greg/AppData/Local/Temp/RtmpM7RbHr/Rinst504119422cd/my_pkg'
E> -----------------------------------
E> ERROR: package installation failed
Type .Last.error.trace to see where the error occurred
Success With devtools::build_vignettes()
Bizarrely, despite the issues above with building vignettes, everything somehow runs smoothly when I call devtools::build_vignettes() sans arguments or with dependencies = TRUE:
i Building my_pkg vignettes
√ Creating 'doc/'
√ Adding '^doc$' to '.Rbuildignore'
√ Setting active project to '<no active project>'
√ Adding '/doc/' to '.gitignore'
√ Setting active project to '<no active project>'
i Moving backstory.html, intro.html, library.html, template.html, usage.html, backstory.R, intro.R, library.R, template.R, and usage.R to doc/
i Copying backstory.Rmd, intro.Rmd, library.Rmd, template.Rmd, and usage.Rmd to doc/
√ Creating 'Meta/'
√ Adding '^Meta$' to '.Rbuildignore'
√ Setting active project to '<no active project>'
√ Adding '/Meta/' to '.gitignore'
√ Setting active project to '<no active project>'
i Building vignette index
Note
Assuming that the fault was mine, and that I had unwittingly introduced an issue somewhere within my R project, I switched to an entirely different Git branch. The most recent commit to this branch had passed devtools::check() with flying colors. However, even after switching over to this "safe" branch, those same issues continued!
Between that last successful check and when the issues began, I made no updates to:
R itself
RStudio
Any R packages
My computer's software (with the exception of a minor anti-malware update from Microsoft).
My computer's hardware
Likewise, the vignettes have been present since far earlier in the project.
Conclusion
I'm hoping to roll out a proof of concept for my_pkg in the rather near future, and the vignettes are quite essential to its usability.
Info by Request
Since "my_pkg" is proprietary, I here anonymize my personal and organizational information (names, filepaths, etc.) as above.
For #SteffenMoritz
Would you mind sharing your DESCRIPTION file and the vignette header/meta information?
The DESCRIPTION file:
Package: my_pkg
Title: Proprietary Package for My Org
Version: 0.0.0.9000
Authors#R:
person(given = "Greg",
family = "Lastname",
role = c("aut", "cre"),
email = c("glastname#myorg.com"))
Description: The `my_pkg` package is a proprietary project for My Org,
and as such I have changed the names to project the innocent.
License: file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
URL: https://github.com/myorg/my_pkg
BugReports: https://github.com/my_org/my_pkg/issues
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
Depends:
R (>= 2.10)
The vignette headers:
intro.Rmd:
---
title: "A Catchphrase!"
author: "Gregory Lastname"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{A Catchphrase!}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
# Show no output.
eval = FALSE, results = "hide",
# Show no dialog.
message = FALSE, warning = FALSE,
# Show no errors.
error = TRUE, purl = FALSE,
# Default format.
collapse = TRUE, comment = "#>"
)
```
backstory.Rmd:
---
title: "A Reference, to Science Fiction"
author: "Gregory Lastname"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{A Reference, to Science Fiction}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
# Show no output.
eval = FALSE, results = "hide",
# Show no dialog.
message = FALSE, warning = FALSE,
# Show no errors.
error = TRUE, purl = FALSE,
# Default format.
collapse = TRUE, comment = "#>"
)
```
library.Rmd
---
title: "A Generic One-Liner"
author: "Gregory Lastname"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{A Generic One-Liner}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
# Show no output.
eval = FALSE, results = "hide",
# Show no dialog.
message = FALSE, warning = FALSE,
# Show no errors.
error = TRUE, purl = FALSE,
# Default format.
collapse = TRUE, comment = "#>"
)
```
template.Rmd
---
title: "A Well-Written Description"
author: "Gregory Lastname"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{A Well-Written Description}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
# Show no output.
eval = FALSE, results = "hide",
# Show no dialog.
message = FALSE, warning = FALSE,
# Show no errors.
error = TRUE, purl = FALSE,
# Default format.
collapse = TRUE, comment = "#>"
)
```
usage.Rmd
---
title: "An Exhortation!"
author: "Gregory Lastname"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{An Exhortation!}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
# Show no output.
eval = FALSE, results = "hide",
# Show no dialog.
message = FALSE, warning = FALSE,
# Show no errors.
error = TRUE, purl = FALSE,
# Default format.
collapse = TRUE, comment = "#>"
)
```
For #Alexis
What do you see if you open the .Rproj file with a text editor?
The my_pkg.Rproj file, as opened in MS Notepad. NOTE: This file has not been modified since the very initial commit.
Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
By request
Does it work if you run R CMD build/INSTALL ... from the command line?
I also built from the command line
greg#CO-GLASTNAME MINGW64 ~/Workspace/R
$ R CMD build C:/Users/greg/Workspace/R/Packages/my_pkg
but I got the same output echoed above:
* checking for file 'C:/Users/greg/Workspace/R/Packages/my_pkg/DESCRIPTION' ... OK
* preparing 'my_pkg':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
-----------------------------------
* installing *source* package 'my_pkg' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'my_pkg'
finding HTML links ... done
foo html
my_pkg-package html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error : package 'my_pkg' is not installed for 'arch = x64'
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'C:/Users/greg/AppData/Local/Temp/RtmpgFIc2r/Rinst1cc0231a6b37/my_pkg'
-----------------------------------
ERROR: package installation failed
You are probably right and it is a problem with the vignette.
(but of course I can't be 100% sure, as I don't know your files)
About your confusion about the check() and install() runs:
RStudio’s “build and reload doesn’t build vignettes
That is why you probably have to run devtools::install() to get the error.
I'll post you some most likely issues with the vignette (here is also a good longer tutorial):
First check the following things:
The directory is called vignettes/ and not vignette/.
Check that vignettes are not covered by .Rbuildignore
Ensure you have the necessary vignette metadata (your seemed good from the first look)
Most likely these thing will be alright for you (but just to check).
In my opinion the most likely issue is, that your DESCRIPTION file does not contain all the necessary dependencies for your .Rmd vignettes
Also better write:
VignetteBuilder: knitr, rmarkdown
Still keep rmarkdown additionally in the Suggests. Also knitr to both, Suggests and VignetteBuilder.
Even more important(!) you also need the packages, that are used in your .Rmd files in Suggests. Since you are using RMarkdown I am assuming, there is some code in your vignettes.
Go through your code and look which packages you are using. Any packages used by the vignette should be declared in the DESCRIPTION.
I could imagine this might also be the reason, why it seemingly worked once and then after changing nothing (in your opinion) it fails.
Could be you still had all the required packages loaded in the background when it worked. So that it did not have an impact, that the packages were missing in Suggests.
This would be my first guess, what the problem could be.
If this does not work, I would try removing vignettes, to see if it is a certain vignette that causes the problem.
What solved it in my case was switching from %\VignetteEngine{knitr::rmarkdown} to %\VignetteEngine{knitr::knitr}. I have no idea why, but it stopped the error and putting back rmarkdown instead of knitr reproduced the error.
Unresolved
As of now, no answer has been posted that solves the titular error. I am posting this by way of clarification, to any users encountering the same error, that the error remains undiagnosed and unresolved. Indeed, the error has persisted even after resetting my project via Git and reinstalling R (and Rtools and RStudio) from scratch.
My thanks to #SteffenMoritz and #Alexis for their tenacious debugging sessions. While our efforts were unsuccessful*, I appreciate their time, effort, and friendliness. Anyone struggling with similar issues would do well to follow their advice, found in an answer and in the comments.
I will update this post with any true solution I might encounter in the future.
* Hence, the bounty has been left to the default mechanism (and so halved) upon expiration.

R install.package fails on data-raw file not found

I am building an R package, with some associated data. I have created a data-raw folder using usethis:: functions, put various txt fies there, and built out R code to generate the .rda/Rdata files. I have used the use_data() function to generate the .rda and Rdata files and these I can see in /data.
I can retrieve these objects using load_all().
I then build a source package, which generates a compressed-tar-ball.
Finally I attempt to install that tar-ball/package in another project and get:
devtools::install_local("/home/fred/Rprojects/evidently/evidently_0.0.2.1.tar.gz")
✓ checking for file ‘/tmp/Rtmp53yb8S/remotes2eaf7a4fc2cb/evidently/DESCRIPTION’ ...
─ preparing ‘evidently’:
✓ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘evidently_0.0.2.1.tar.gz’
Installing package into ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘evidently’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error : **'/tmp/Rtmp0PbObQ/R.INSTALL391126f5cc7c/evidently/data-raw/TPBULET-A.txt' does not exist.**
Error: unable to load R code in package ‘evidently’
Execution halted
ERROR: lazy loading failed for package ‘evidently’
* removing ‘/home/fred/R/x86_64-pc-linux-gnu-library/4.0/evidently’
* restoring previous ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0/evidently’
Error: Failed to install 'evidently' from local:
(converted from warning) installation of package ‘/tmp/Rtmp53yb8S/file2eaf5f6ca68c/evidently_0.0.2.1.tar.gz’ had non-zero exit status
>
But the file it says it is looking for is in data-raw in the package folder.
I am missing something obvious here. I would welcome suggestions on why the system is not seeing the txt file, and why it is therefore aborting the install.
This happens when you have a rogue link to the data-raw file, in a file you thought you had purged, and when it gets loaded as part of install-packages, it tries to find a file in data-raw/ that is not there in the package, because data-raw/ is not part of the package, just in the source code. So, search your files and find the forgotten bit of code. Hang head in shame.

R install package tabplot

When I install R package, tabplot, below message has come.
My R version has updated 4.0.4 because 4.0.2 had same error.
error message is below)
Warning in install.packages :
package ‘tabplot’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Could you pls share how to resolve this issue?
Let's go meta for a moment:
What are you trying to do? Do you have a particular function in that archived package that you are hoping to apply to your dataset? ( which would imply that we needed to know which function. ... and a bunch of other questions.)
Or is this an effort to follow a blog or tutorial from the Web? (Again which one?)
I see this when I execute:
> install.packages("tabplot")
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘tabplot’ is not available (for R version 3.6.3)
So at this point my guess is that the tabplot maintainer has not keep pace with the evolution of R. Because ... packages that depend on the syntax or the behavior of core R functions or the CRAN rules that might change over time depending on the considered decisions of the R Core and CRAN. That's just the way it is. There's a further sort of language/system evolution that Hadley spawned.(ggplot and magrittr/ddplyr/rlang). (Arguably the S4 tributary is in the same category. The last CRAN-accepted version was downloadable from: <search-for exact URL> at 'an URL to be named later"' produces "Archived on 2020-02-19 as check problems were not corrected despite reminders." So that's pretty recent. Perhaps we can just download a copy of the most recent "tabplot-xx.xx.xx.xx.tar.gz" file from the CRAN archive and install from local source. (Note: need to use repo=NULL in the install.packages call.)
Well, that's not working yet because of an unmet dependency on an object named clone from package:ff.
install.packages("~/Downloads/tabplot/", repos =NULL)
#--------------
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
** package ‘tabplot’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘clone’ is not exported by 'namespace:ff'
Execution halted
ERROR: lazy loading failed for package ‘tabplot’
* removing ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/tabplot’
So perhaps you can live with some drop-in R code from the expanded source on the CRAN Archive?
EDIT: So I tried figuring out how to handle that sort of error and finally decided to try changing the NAMESPACE file. It's a text file that names various functions and where the program should find them. The two lines I needed to change were the ones importing ff:::clone and ff:::is.factor.ff so change them to
importFrom(bit, clone) # the bit package has an exported version
importFrom(ff, is.factor) # removed the `.ff` from its name
And now I get:
install.packages("~/Downloads/tabplot/", repos =NULL)
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
file ‘NAMESPACE’ has the wrong MD5 checksum
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tabplot)
The warning message is because I edited the NAMESPACE file but didn't do a full rebuild. Also note that you will not need the Rtools on a Windoze machine or the XCode and CLT on a Mac because there is no compiled code in this package.
It does appear that most of my efforts are paralleling the changes being made to the github version. See https://github.com/mtennekes/tabplot/issues/21 where the is.factor.ff issue was addressed 2 days ago. The author/maintainer says the package will be resubmitted to CRAN.
Despite claims that resubmission will occur. there does not seem to be any progress on that front. https://cran-archive.r-project.org/web/checks/2020/2020-02-19_check_results_tabplot.html However the github page suggests an installation via devtools and that succeeds for version 1.4.1 on an Ubuntu machine, despite the reports of errors in the earlier version that had been submitted to CRAN.

R package not compatible with 3.5.3

I am attempting to install a package that was made on my computer, but I am having issues. Installing seemed to work fine, but I got a warning:
Warning in install.packages :
package ‘abcmlr’ is not available (for R version 3.5.3)
This naturally throws the error when calling library
Error in library(abcmlr) : 'abcmlr' Not a valid package that has already been installed
Using .libPaths() returns "C:/Users/amlut/Documents/R/win-library/3.5" "C:/Program Files/R/R-3.5.3/library". So I presume this is why library() is giving me an error.
Why does installing my package not work for version 3.5.3 (Does this question require additional information about my package)? Is it possible to make my package work for 3.5.3? What steps would be required to achieve this?
Thank you.
Edit: this is a package I made, and I am using devtools::install
DESCRIPTION:
Package: abcmlr
Type: Package
Title: Analysis of Bone Counts by Maximum Likelihood
Version: 0.1.0
Author:
Maintainer:
Description: See Rogers ABCML for details
License:
Encoding: UTF-8
LazyData: true
NeedsCompilation: no
Packaged: 2019-06-14 21:17:42 UTC; amlut
Built: R 3.5.3; ; 2019-06-14 21:17:43 UTC; windows
Output from devtools::install:
devtools::install("C:/Users/amlut/Documents/R/win-library/3.5/abcmlr")
WARNING: Rtools is required to build R packages, but the version of Rtools previously installed in C:/Rtools has been deleted.
Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\amlut\Documents\R\win-library\3.5\abcmlr/DESCRIPTION' ...
- preparing 'abcmlr':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
Removed empty directory 'abcmlr/man'
- building 'abcmlr_0.1.0.tar.gz'
Running "C:/PROGRA~1/R/R-35~1.3/bin/x64/Rcmd.exe" INSTALL "C:\Users\amlut\AppData\Local\Temp\RtmpGySaDj/abcmlr_0.1.0.tar.gz" --install-tests
* installing to library 'C:/Users/amlut/Documents/R/win-library/3.5'
* installing *source* package 'abcmlr' ...
** R
** byte-compile and prepare package for lazy loading
No man pages found in package ** help
'abcmlr'
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (abcmlr)
In R CMD INSTALL
library(abcmlr)

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

Resources