RStudio * checking package dependencies ... ERROR - r

this has now been bugging me for a while now and I can't make other related pieces of advice fit to my problem. Yes, i have perused the net for help.
Problemstatement:
I have written a package with all the basic requirements to make a first build.
However, I have two dependecies (functions from other packages) which seemingly can't be loaded.
==> Rcmd.exe build mypackage
[...]
* using log directory 'mydirectory/mypackage.Rcheck'
* using R version 2.15.2 (2012-10-26)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'mypackagel/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'mypackage' version '0.01'
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Package required but not available: 'otherpackage'
Exited with status 1.
Now I am using RStudio to do the package building. However, it seems I cannot make it find the 'otherpackage'. Where do I set this under Windows/RStudio?
Anyone can give a quick hint, please?

Related

Compile R package "arulesSequence" for older release

I want to use arulessequences for sequence mining. I have to use it in Oracle R distribution version R 3.3.0 (last released) and The problem is that the last version of the arulesSequences package is R >= 3.3.2. So I get an error for this problem:
Error: this is R 3.3.0, package arulesSequences needs >=3.3.2
So I decided to compile the source code for older release. I downloaded an older package that needs R 3.2.5 or above. And I know that this package is depended to arules. so I have installed it already. I used following instructions to compile the arulessequences package:
in the source directory I run this command:
R CMD build arulesSequences
the output of this command is:
c:\rr\arulesSequences_0.2-17>R CMD build arulesSequences
* checking for file 'arulesSequences/DESCRIPTION' ... OK
* preparing 'arulesSequences':
* checking DESCRIPTION meta-information ... OK
* cleaning src Warning in cleanup_pkg(pkgdir, Log) : unable to run 'make clean' in 'src'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'arulesSequences_0.2-17.tar.gz'
a file named 'arulesSequences_0.2-17.tar.gz' get created but when I check it as below I get the following as output:
c:\rr\arulesSequences_0.2-17\arulesSequences>R CMD check arulesSequences
* using log directory 'c:/rr/arulesSequences_0.2-17/arulesSequences/arulesSequences.Rcheck'
using R version 3.4.0 (2017-04-21)
using platform: x86_64-w64-mingw32 (64-bit)
using session charset: ISO8859-1
checking for file 'arulesSequences/DESCRIPTION' ... OK
this is package 'arulesSequences' version '0.2-17'
checking package namespace information ... OK
checking package dependencies ... ERROR Package required but not available: 'arules'
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
* DONE Status: 1 ERROR
I know the arules package is installed and I checked it. It seems the build process is not successful. do you have any idea to help solve this out?
You have to first install c/c++ compiler for R(called gcc) that is under R's additional build tools.
to do that, in RStudio goto File->New File ->c++ File.
It will show the following dialogue:
Then click on yes.
to compile a package under windows, you have to set repo to Null and type to source.
you can use this command to do that:
install.packages("SOURCEADDRESS",type="source",repo=null)
as #EugèneAdell mentioned above you have to first install arules. then arulessequences.
Instead of building, take the archive packages that seem to be ok for your R version and install them. On my Linux, this gives :
wget http://cran.univ-paris1.fr/src/contrib/Archive/arules/arules_1.5-0.tar.gz
R CMD INSTALL $HOME/arules_1.5-0.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arules’ ...
...
** testing if installed package can be loaded
* DONE (arules)
wget http://cran.univ-paris1.fr/src/contrib/Archive/arulesSequences/arulesSequences_0.2-17.tar.gz
R CMD INSTALL $HOME/arulesSequences_0.2-17.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arulesSequences’ ...
...
** testing if installed package can be loaded
* DONE (arulesSequences)
R
> library(arulesSequences)
Loading required package: arules
Loading required package: Matrix
Attaching package: ‘arules’
Maybe a more recent version for arules is possible, I just took the first one from the 1.5 series.

Note in R CRAN check -- * checking top-level files ... NOTE File README.md cannot be checked without ‘pandoc’ being installed

I am checking my R package for CRAN submission, but there is one NOTE that I cannot get rid of. I googled it but seems this NOTE is not common thus I didn't find much useful information. Could any one provide me with a solution? Below is part of the output from R CMD check --as-cran.
* using R version 3.2.0 (2015-04-16)
* using platform: x86_64-apple-darwin13.4.0 (64-bit)
* using session charset: UTF-8
* using option ‘--as-cran’
...
...
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
File README.md cannot be checked without ‘pandoc’ being installed.
* checking for left-over files ... OK
* checking index information ... OK
You can install pandoc from within R using install.pandoc() from the installr package.

Error in R CMD check: "Packages required but not available"

The following is log of R CMD check package error:
* using log directory 'C:/Users/erdogan/Documents/Revolution/causfinder.Rcheck'
* using R version 2.15.3 (2013-03-01)
* using platform: i386-w64-mingw32 (32-bit)
* using session charset: CP1254
* checking for file 'causfinder/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'causfinder' version '1.0'
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Packages required but not available:
'combinat' 'gtools' 'calibrate' 'scales'
See the information on DESCRIPTION files in the chapter 'Creating R packages' of the 'Writing R Extensions' manual.
In my description file, I have all the required files ('combinat' 'gtools' 'calibrate' 'scales') under "Depends:" heading.
What I did till now: I added the above packages under "Suggests:" as well.
Though that the error is sticky.
>.libPaths()
[1] "C:/Revolution/R-Enterprise-7.1/R-3.0.2/library"
I checked both within and outside R:
> devtools::check("C:/Revolution/R-Enterprise-7.1/R-3.0.2/library/causfinder")
From Command Prompt (Windows 7):
C:\Users\erdogan\Documents\Revolution>R CMD check causfinder
* using log directory 'C:/Users/erdogan/Documents/Revolution/causfinder.Rcheck'
* using R version 2.15.3 (2013-03-01)
* using platform: i386-w64-mingw32 (32-bit)
* using session charset: CP1254
* checking for file 'causfinder/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'causfinder' version '1.0'
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Packages required but not available:
'combinat' 'gtools' 'calibrate' 'scales'
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
I also observed the following interesting situation: in the log file, R version is specified as 2.15.3; however, when I do the following, I got different R version!
> R.Version()
$platform
[1] "i386-w64-mingw32"
$version.string
[1] "R version **3.0.2** (2013-09-25)"
Any help will be greatly appreciated.

Functions are not getting imported when I create a new R package

I am writing a new extension for R. I have loaded all my functions into the Global Environment and ran
package.skeleton('package_name')
in the NAMESPACE file I have added all the required packages:
import(PerformanceAnalytics)
import(fBasics)
import(splines)
import(quantmod)
and added a LazyData:yes option to the DESCRIPTION file.
When I R CMD INSTALL package_name it goes without errors, only with several warnings:
When I run the package check I get
* using log directory 'folder path here'
* using R version 2.15.0 (2012-03-30)
* using platform: i386-pc-mingw32 (32-bit)
* using session charset: ISO8859-1
* checking for file 'package_name/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'package_name' version '1.0'
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Namespace dependencies not required:
'PerformanceAnalytics' 'fBasics' 'quantmod'
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
In the R session typing library(package_name) all is being loaded without errors (few warnings with the naming conventions) but I cannot see any of the functions. What could possible cause that? When I do all the above with the tutorial example everything works fine. No S3 or S4 is being used - just plain R functions
Thanks,
Vladimir

Error in R CMD Check: Packages required but not available

I am trying to create a package. It depends on several packages. I added the imports to the namespace file and the Depends in the description file.
I found possible solutions here and here, but these didn't work- I think because I am on CentOS.
This is what I see on my screen:
[hadoop#localhost RProjects]$ sudo R CMD check TextPreProcess
* using log directory ‘/home/hadoop/RProjects/TextPreProcess.Rcheck’
* using R version 2.15.1 (2012-06-22)
* using platform: x86_64-redhat-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘TextPreProcess/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘TextPreProcess’ version ‘1.0’
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Packages required but not available:
‘RWeka’ ‘Snowball’ ‘lsa’ ‘plyr’ ‘snowfall’ ‘tau’ ‘tm’
See the information on DESCRIPTION files in the chapter ‘Creating R
packages’ of the ‘Writing R Extensions’ manual.
I went through Writing R Extentions but I couldn't derive a lot of insight as to how to solve my problem.
It's working now.
What I did was:
add ~/R/x86_64-redhat-linux-gnu-library/2.15 to .libPaths (That's where my R library was)
Detach all libraries in R
Restart the R session. (For multiple sessions, close all of them.)
install the required packages.
Check if the Imports & Exports are correct in the namespace file.
Check if the required fields are available in the Description file. Make sure all dependencies are handled between 'Depends', 'Imports', 'Suggests' and 'Enhances'.
Checked it. R CMD check <pkg>. Built it. R CMD build <pkg>. Installed it. R CMD INSTALL <tarball>.
Done.
I had the same problem because packages were installed but for different R versions.
To solve, I opened the old R version (the one the package was built under), and installed the missing packages under that version and it solved the problem.
E.g.
# Version should match the version your package was built in
R.version
# 3.5.1
install.packages(c('stringr', 'lubridate', 'testthat'))
Tips
If you need to check your R version, simply type R.version
If you need to switch R version, hold control while starting RStudio on windows, or on mac download a very simple application called RSwitch to instantly switch between version (you'll still need to restart the R session with .rs.restartR()

Resources