I am using devtools::check(document=FALSE,args=c('--no-multiarch')) to perform the checks for my package.
When the above command performs R --vanilla CMD check "C:\sometmpfolder/mypackage.tar.gz" --timings --no-multiarch,
it stops at
* checking Rd cross-references ...
i.e., this is the last line in mypackage.Rcheck/00check.log. There is no error message - the check seems to freeze.
I use roxygen2 to create my documentation. The cross references that I use are of the form \link{somefunction} and \link[somepkg]{somefunction}.
I am running R 3.1.2 on a Win 7 machine.
But I think that I have seen a similar behaviour with earlier versions of R and without roxygen2 as well.
Do you guys know why the check stops at the cross-references?
It turned out that an incorrect statement of the form
\link[somepkg]{somefunction}
was the problem. In my case I used the incorrect command \link[reshape]{melt} although it should be \link[reshape2]{melt}.
This caused the Rd cross-reference check to take forever (actually, it finished after nearly one hour). After correcting to \link[reshape2]{melt} the Rd cross-reference check only took a minute or so.
Related
i just set up R to work with Jupyter notebooks in vscode but it is marking the first string of my kernels in red.
The message I get is:
Failed to run diagnostics: ! error in callr subprocess
Caused by error:
! Full file exclusions must be character vectors of length 1. items: 1 are not! lintr
if i uninstall languageserver package then it disappears but vscode asks me to reinstall it and then it comes back
how do i get rid of this?
This is not an answer..
Just information about a similar problem
Could you try to run the R code below:
lintr::use_lintr(type = "tidyverse")
see https://github.com/r-lib/lintr/blob/main/README.md#lintr-file-example for reference.
I think it creates a .lintr file that defines a default behaviour for lintr within your project directory.So you might need to run the code above each time you have a new project
devtools::test() gives me a warning each time one of my internal function is ran. But when I run the incriminated codes in the console there is no warning. In addition R CMD check or devtools::check() don't complain about these lines of code (no error, no warning, no note).
So it means that devtools::test() run the tests using different settings compared to the regular R environment and compared to R CMD check.
I investigated and I didn't find any hint even if I found several topics with more a less comparable questions. This is not really a problem because the outputs are good and the problem does not occur on CRAN or when running the code. But I would like to remove these warning from devtools::test().
Please note that my question does not concern how to fix the warnings but how to get a chance to reproduce the problem in attempt to solve it.
I've just started using RStudio's build check, and used it to make one package already. I've started on a second package, and this one is failing. As the build attempt happens, I get updates like:
* checking whether package ‘< package >’ can be installed ... ERROR
Installation failed.
See ‘/home/user/git/< package >.Rcheck/00install.out’ for details.
* DONE
Status: 1 ERROR
The problem is that the defined folder < package >.Rcheck doesn't exist, and neither do the files that are supposed to be in it (i.e. 00install.out, and 00check.log). Also, where I write < package >, the actual name of my package is shown instead.
I had folders view visible while the package was building, and I saw the .Rcheck folder appear, and then disappear shortly after. I was even able to browse the 000install.out file, but it had not yet encountered any errors.
It appears that the whole Rcheck folder is being removed when the build fails, leaving me with no trace of what caused the error.
Has anyone else experienced this? I'm using RStudio version 0.99.902 with R version 3.3.1 on Arch Linux.
My approach is the following one:
Go to 'Tools' -> 'Global Options' -> 'Packages' and then have a look, if 'View Rcheck directory after failed R CMD check' is ticked. You find other useful options there, too, e.g. 'Cleanup output after successful R CMD check'.
A little more detail on how to preserve error logs, based on the answer from #J_F. I needed to tick View Rcheck directory after failed R CMD check, because the cleanup occurs after the misleading message
See
‘.../yourpackage.Rcheck/00check.log’
for details.
I also needed to untick Cleanup output after successful R CMD check, because R CMD can succeed even when there are errors!
R CMD check results
1 error | 3 warnings | 2 notes
Warning messages:
1: `cleanup` is deprecated
2: Version of roxygen2 last used with this package is 6.0.1.9000. You only have version 6.0.1
R CMD check succeeded
After editing the DESCRIPTION file in a package I am developing, I am not able to use R CMD build anymore. R seems to be unable to read it.
Here is the error message:
$ R CMD build ~/projects/mypackage
* checking for file ‘/home/user/projects/mypackage/DESCRIPTION’ ... OK
* preparing ‘mypackage’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
Error in .read_description(ldpath) :
file 'mypackage/DESCRIPTION' does not exist
Execution halted
It is rather cryptic, isn't it ?
The file is here of course, and it is even found by R in the first line.
As you might expect, removing the DESCRIPTION file make the process fail on the first check:
$ R CMD build ~/projects/mypackage
* checking for file ‘/home/user/projects/mypackage/DESCRIPTION’ ... NO
Observations:
I tried to run it from another relative path (mypackage, .) without success.
It also failed on the CI server, and on a freshly cloned repository.
R CMD check ~/projects/mypackage runs without error as well as R -e "library(devtools); load_all();" (only a couple of unrelated warnings)
The only resource I have found is a similar bug affecting windows builds. I am not in this situation.
If I change the content of the Package field in DESCRIPTION to foo, without changing anything else, the error becomes Error in .read_description(ldpath) : file 'mypackage/DESCRIPTION' does not exist
There is a cleanup script deleting a bunch of files. Removing it does not solve the problem.
I am running:
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Platform: x86_64-pc-linux-gnu (64-bit) (Debian Jessie)
In my case, this .Rbuildignore would trigger error
^sccomp\.Rproj$
^\.Rproj\.user$
^\.github
^README*
^dev*
This would not
^sccomp\.Rproj$
^\.Rproj\.user$
^\.github
^README*
^dev
The difference is the asterisk after ^dev
If I can comment, this is shocking and made me waste 2 days. I'm wondering how can I notify R people
Comments the setwd line in my .Rprofile, and all errors gone, really saved my ass:
#setwd("~/.R/work")
I've been tortured a few days by this error:
Error in tools:::.read_description(file) :
file 'DESCRIPTION' does not exist
You can check out https://csgillespie.github.io/efficientR/set-up.html
a seemingly innocent call to setwd() in .Rprofile, for example, will break devtools build and check functions.
Is there a simple way to trigger a crash in R? This is for testing purposes only, to see how a certain program that uses R in the background reacts to a crash and help determine if some rare problems are due to crashes or not.
The easiest way is to call C-code. C provides a standard function abort()[1] that does what you want. You need to call: .Call("abort").
As #Phillip pointed out you may need to load libc via:
on Linux, dyn.load("/lib/x86_64-linux-gnu/libc.so.6") before issuing .Call("abort"). The path may of course vary depending on your system.
on OS X, dyn.load("/usr/lib/libc.dylib")
on Windows (I just tested it on XP as I could not get hold of a newer version.) you will need to install Rtools[2]. After that you should load dyn.load("C:/.../Rtools/bin/cygwin1.dll").
There is an entire package on GitHub dedicated to this:
crash
R package that purposely crash an R session. WARNING: intended
for test.
How to install a package from github is covered in other questions.
I'm going to steal an idea from #Spacedman, but I'm giving him full conceptual credit by copying from his Twitter feed:
Segfault #rstats in one easy step:
options(device=function(){});plot(1)
reported Danger, will crash your R session.
— Barry Rowlingson (#geospacedman) July 16, 2014
As mentioned in a comment to your question, the minimal approach is a simple call to the system function abort(). One way to do this in one line is to
R> Rcpp::cppFunction('int crashMe(int ignored) { ::abort(); }');
R> crashMe(123)
Aborted (core dumped)
$
or you can use the inline package:
R> library(inline)
R> crashMe <- cfunction(body="::abort();")
R> crashMe()
Aborted (core dumped)
$
You can of course also do this outside of Rcpp or inline, but then you need to deal with the system-dependent ways of compiling, linking and loading.
I'll do this in plain C because my C++-foo isn't Dirkian:
Create a C file, segv.c:
#include <signal.h>
void crashme(){raise(SIGSEGV);}
Compile it at the command line (windows users will have to work this out for themselves):
R CMD SHLIB segv.c
In R, load and run:
dyn.load("segv.so") # or possibly .dll for Windows users
.C("crashme")
Producing a segfault:
> .C("crashme")
*** caught segfault ***
address 0x1d9e, cause 'unknown'
Traceback:
1: .C("crashme")
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
aborting ...
Segmentation fault
This is the same behaviour as the one Thomas references in the graphics system bug report which I have filed and might get fixed one day. However this two-liner will always raise a segfault...
Maybe Dirk can one-line-Rcpp-ise it?
If you want to crash your R, try this
lapply("", function(x) eval(sys.call(1)))
(Save everything before running because this immediately results in "R Session Aborted")
Edit: This works for me on Windows 10.