R CMD check gives warning: Warning: package needs dependence on R (>= 2.10) (which I think comes from using use_data(... overwrite = TRUE))
Is there a way to add the dependency with use_this?
Thanks!
I don't think we currently facilitate this. To the extent that we have a _good_ reason, it's because we try to avoid declaring an explicit R version dependency unless it's really necessary. But perhaps we should have a way to do this.
I have the impression that using use_data() will create that specific dependency requirement?
Try first:
library(usethis)
path <- file.path(tempdir(), "mypkg")
create_package(path)
use_mit_license("My Name")
Gives 0 warnings/errors. Add now:
use_data(iris, overwrite = TRUE)
Gives me:
β― checking data for ASCII and uncompressed saves ... WARNING
Warning: package needs dependence on R (>= 2.10)
Do you confirm? If yes, it might be good to have a function to add R version requirement, and even add it automatically with use_data? R 2.10 was released in 2009, seems safe to assume it...
Thanks!
I think adding Depends: R (>= 2.10) is making a strong assertion that you believe your package will work with all versions of R later than 2.10, and that is not generally true. The version of R that you require is something that you as package developer have to decide, with some thought.
I am not sure I made my point clearly enough. The fact is that using use_data(iris) seems to create a dependency on R 2.10! In a nutshell (full code below):
β― checking data for ASCII and uncompressed saves ... WARNING
#> Warning: package needs dependence on R (>= 2.10)
#>
#> 0 errors β | 2 warnings β | 0 notes β
#> Error: R CMD check found WARNINGs
If this is the case, it seems worth considering:
use_data() warning the user about this?Thanks!
Run:
library(usethis)
path <- file.path(tempdir(), "mypkg")
create_package(path)
#> β Setting active project to '/tmp/RtmpTCxYQx/mypkg'
#> β Creating 'R/'
#> β Creating 'man/'
#> β Writing 'DESCRIPTION'
#> β Writing 'NAMESPACE'
use_mit_license("My Name")
#> β Setting License field in DESCRIPTION to 'MIT + file LICENSE'
#> β Writing 'LICENSE.md'
#> β Adding '^LICENSE\\.md$' to '.Rbuildignore'
#> β Writing 'LICENSE'
devtools::check(path)
#> ββ Building βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ mypkg ββ
#> Setting env vars:
#> β CFLAGS : -Wall -pedantic
#> β CXXFLAGS : -Wall -pedantic
#> β CXX11FLAGS: -Wall -pedantic
#> ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#>
checking for file β/tmp/RtmpTCxYQx/mypkg/DESCRIPTIONβ ...
β checking for file β/tmp/RtmpTCxYQx/mypkg/DESCRIPTIONβ
#>
β preparing βmypkgβ:
#>
checking DESCRIPTION meta-information ...
β 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 βmypkg/Rβ
#> Removed empty directory βmypkg/manβ
#> β building βmypkg_0.0.0.9000.tar.gzβ
#>
#>
ββ Checking βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ mypkg ββ
#> Setting env vars:
#> β _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> β _R_CHECK_CRAN_INCOMING_REMOTE_ : FALSE
#> β _R_CHECK_CRAN_INCOMING_ : FALSE
#> β _R_CHECK_FORCE_SUGGESTS_ : FALSE
#> ββ R CMD check ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#>
β using log directory β/tmp/RtmpTCxYQx/mypkg.Rcheckβ
#>
β using R version 3.5.3 (2019-03-11)
#> β using platform: x86_64-pc-linux-gnu (64-bit)
#> β using session charset: UTF-8
#>
β using options β--no-manual --as-cranβ
#> β checking for file βmypkg/DESCRIPTIONβ
#> β this is package βmypkgβ version β0.0.0.9000β
#> β package encoding: UTF-8
#> checking package namespace information ...
β checking package namespace information
#> checking package dependencies ...
β checking package dependencies (1.5s)
#>
β checking if this is a source package
#> β checking if there is a namespace
#> checking for executable files ...
β checking for executable files
#>
β checking for hidden files and directories
#> β checking for portable file names
#> β checking for sufficient/correct file permissions
#>
β checking serialization versions
#> checking whether package βmypkgβ can be installed ...
β checking whether package βmypkgβ can be installed (554ms)
#>
checking installed package size ...
β checking installed package size
#>
checking package directory ...
β checking package directory
#> checking DESCRIPTION meta-information ...
β checking DESCRIPTION meta-information
#>
β checking top-level files
#> β checking for left-over files
#> β checking index information
#> checking package subdirectories ...
β checking package subdirectories
#>
checking whether the package can be loaded ...
β checking whether the package can be loaded
#>
checking whether the package can be loaded with stated dependencies ...
β checking whether the package can be loaded with stated dependencies
#>
checking whether the package can be unloaded cleanly ...
β checking whether the package can be unloaded cleanly
#>
checking whether the namespace can be loaded with stated dependencies ...
β checking whether the namespace can be loaded with stated dependencies
#>
checking whether the namespace can be unloaded cleanly ...
β checking whether the namespace can be unloaded cleanly
#>
checking loading without being on the library search path ...
β checking loading without being on the library search path
#>
checking examples ...
β checking examples ... NONE
#>
#>
#>
#> ββ R CMD check results ββββββββββββββββββββββββββββββ mypkg 0.0.0.9000 ββββ
#> Duration: 3.5s
#>
#> 0 errors β | 0 warnings β | 0 notes β
Created on 2019-03-17 by the reprex package (v0.2.1)
Now use add_data():
library(usethis)
path <- file.path(tempdir(), "mypkg")
create_package(path)
#> β Setting active project to '/tmp/RtmpMZIYxZ/mypkg'
#> β Creating 'R/'
#> β Creating 'man/'
#> β Writing 'DESCRIPTION'
#> β Writing 'NAMESPACE'
use_mit_license("My Name")
#> β Setting License field in DESCRIPTION to 'MIT + file LICENSE'
#> β Writing 'LICENSE.md'
#> β Adding '^LICENSE\\.md$' to '.Rbuildignore'
#> β Writing 'LICENSE'
use_data(iris)
#> β Creating 'data/'
#> β Saving 'iris' to 'data/iris.rda'
devtools::check(path)
#> ββ Building βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ mypkg ββ
#> Setting env vars:
#> β CFLAGS : -Wall -pedantic
#> β CXXFLAGS : -Wall -pedantic
#> β CXX11FLAGS: -Wall -pedantic
#> ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#>
checking for file β/tmp/RtmpMZIYxZ/mypkg/DESCRIPTIONβ ...
β checking for file β/tmp/RtmpMZIYxZ/mypkg/DESCRIPTIONβ
#>
β preparing βmypkgβ:
#>
checking DESCRIPTION meta-information ...
β 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 βmypkg/Rβ
#> Removed empty directory βmypkg/manβ
#> β looking to see if a βdata/datalistβ file should be added
#> β building βmypkg_0.0.0.9000.tar.gzβ
#>
#>
ββ Checking βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ mypkg ββ
#> Setting env vars:
#> β _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> β _R_CHECK_CRAN_INCOMING_REMOTE_ : FALSE
#> β _R_CHECK_CRAN_INCOMING_ : FALSE
#> β _R_CHECK_FORCE_SUGGESTS_ : FALSE
#> ββ R CMD check ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#>
β using log directory β/tmp/RtmpMZIYxZ/mypkg.Rcheckβ
#>
β using R version 3.5.3 (2019-03-11)
#> β using platform: x86_64-pc-linux-gnu (64-bit)
#> β using session charset: UTF-8
#>
β using options β--no-manual --as-cranβ
#>
β checking for file βmypkg/DESCRIPTIONβ
#> β this is package βmypkgβ version β0.0.0.9000β
#>
β package encoding: UTF-8
#> β checking package namespace information
#> checking package dependencies ...
β checking package dependencies (954ms)
#>
β checking if this is a source package
#> β checking if there is a namespace
#> checking for executable files ...
β checking for executable files
#>
β checking for hidden files and directories
#> β checking for portable file names
#> β checking for sufficient/correct file permissions
#>
β checking serialization versions
#> checking whether package βmypkgβ can be installed ...
β checking whether package βmypkgβ can be installed (477ms)
#>
checking installed package size ...
β checking installed package size
#>
checking package directory ...
β checking package directory
#> checking DESCRIPTION meta-information ...
β checking DESCRIPTION meta-information
#>
β checking top-level files
#> β checking for left-over files
#> β checking index information
#> checking package subdirectories ...
β checking package subdirectories
#>
checking whether the package can be loaded ...
β checking whether the package can be loaded
#>
checking whether the package can be loaded with stated dependencies ...
β checking whether the package can be loaded with stated dependencies
#>
checking whether the package can be unloaded cleanly ...
β checking whether the package can be unloaded cleanly
#>
checking whether the namespace can be loaded with stated dependencies ...
β checking whether the namespace can be loaded with stated dependencies
#>
checking whether the namespace can be unloaded cleanly ...
β checking whether the namespace can be unloaded cleanly
#>
checking loading without being on the library search path ...
β checking loading without being on the library search path
#>
checking for missing documentation entries ...
W checking for missing documentation entries
#>
Undocumented code objects:
#> βirisβ
#> Undocumented data sets:
#> βirisβ
#> All user-level objects in a package should have documentation entries.
#> See chapter βWriting R documentation filesβ in the βWriting R
#> Extensionsβ manual.
#> β checking contents of βdataβ directory
#> checking data for non-ASCII characters ...
β checking data for non-ASCII characters
#>
checking data for ASCII and uncompressed saves ...
W checking data for ASCII and uncompressed saves
#>
Warning: package needs dependence on R (>= 2.10)
#> checking examples ...
β checking examples ... NONE
#>
#> See
#> β/tmp/RtmpMZIYxZ/mypkg.Rcheck/00check.logβ
#> for details.
#>
#>
#>
ββ R CMD check results ββββββββββββββββββββββββββββββ mypkg 0.0.0.9000 ββββ
#> Duration: 3.3s
#>
#> β― checking for missing documentation entries ... WARNING
#> Undocumented code objects:
#> βirisβ
#> Undocumented data sets:
#> βirisβ
#> All user-level objects in a package should have documentation entries.
#> See chapter βWriting R documentation filesβ in the βWriting R
#> Extensionsβ manual.
#>
#> β― checking data for ASCII and uncompressed saves ... WARNING
#> Warning: package needs dependence on R (>= 2.10)
#>
#> 0 errors β | 2 warnings β | 0 notes β
#> Error: R CMD check found WARNINGs
Created on 2019-03-17 by the reprex package (v0.2.1)
You were quite clear. usethis can not automatically add a dependency on an R version because we do not what versions of R you wish to support.
No, the add R dependency automatically is just subsidiary to my main point (and should be discarded). Main question is: can usethis provide a functionality so that user can add R dependency?
This request is motivated by the fact that using use_data() seems to create an (implicit) dependency on R 2.10, according to the R CMD check. Hadley, do you agree with that premise? If no, please discard indeed that whole message. If yes, do you think usethis can help the user solve that dependency issue?
Thanks
If the running of use_data() indeed automatically implies a dependence on at least 2.10, then I also think it would be logical if use_data() would by default check whether there is a dependence already defined, and whether it is at least 2.10, and if not, or it is below it, it'd include a dependence / increase it to 2.10.
Yes, @hadley is of course right that "we do not what versions of R you wish to support", but if the above assertion is correct, then 2.10 needs to be the minimum if you run use_data(), so I think the consistent course of action would be if use_data() would handle this. The user can still change it to something higher, if he/she needs it due to other reasons.
I feel this issue still deserve attention. @hadley , would you mind giving it a second thought?
@tamas-ferenci summarized it well: if using use_data() indeed automatically implies a dependency to R 2.10 (which I believe is true, see code above, but I might be wrong), should usethis not check that the required version is not at least 2.10?
Currently using usethis::use_data() requires adjusting manually the DESCRIPTION file, which undermines the nice workflow of usethis
@MatthieuStigler what is the problem? use_data() automatically adds a dependency on R 2.10.
oh my bad, hadn't realized it was actually included (my mistake was to run use_description and not re-run use_data after that), sorry about that!
Most helpful comment
If the running of
use_data()indeed automatically implies a dependence on at least 2.10, then I also think it would be logical ifuse_data()would by default check whether there is a dependence already defined, and whether it is at least 2.10, and if not, or it is below it, it'd include a dependence / increase it to 2.10.Yes, @hadley is of course right that "we do not what versions of R you wish to support", but if the above assertion is correct, then 2.10 needs to be the minimum if you run
use_data(), so I think the consistent course of action would be ifuse_data()would handle this. The user can still change it to something higher, if he/she needs it due to other reasons.