Code Monkey home page Code Monkey logo

rrtools's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rrtools's Issues

Create GitHub Repo did not worked on Mac

While trying out the workflow during lunchtime today on @nmueller18 mac, Creating GitHub repository resulted in

Fehler in stop(github_error(req)) : Not Found (404)

We had to create the repo by hand and had to use git remote add stattinstead ofgit remote set-url`.

Could not find a pull request solving that issue, so it might remain a problem. From my Arch machine, everything went well regarding this.

Organize README around concepts rather than functions

Currently, the how to section in the README is organized by rrtools function. However, there are several places where the appropriate function depends on the user's choice (e.g., which license to use), or where there are steps the user has to complete before running the rrtools function (e.g., when setting up version control).

Does it make sense to instead organize this section around the concept each step represents (e.g., create the package, choose a license, use version control), listing any prerequisite steps, and then the function? One potential benefit is that this would help reinforce the key components of rr, particularly for people who are less familiar with them. The downside, of course, is that it requires a bit more effort to locate the appropriate function. Organizing things conceptually seems useful to me, but perhaps the current approach was intentional?

Happy to make a first attempt at this, if others are amenable.

use GitLab

Are there any plans to enable users to use GitLab and its CI service instead of GitHub and Travis/CircleCI? That would be fantastic as one could use (unlimited) private repositories.

If you don't plan on extending the package, do you have suggestions on how one could integrate GitLab plus CI into the rrtools workflow? Thanks!

Thesis and book templates

Perhaps https://github.com/ismayc/thesisdown for a thesis and just https://github.com/rstudio/bookdown-demo for a book?

Do we simply have use_analysis(structure = c("paper", "thesis", "book")) and then, depending on the choice, create either:

Does this seem like the right way to provide these options?

README.Rmd won't allow pkgdown site to build

If using pkgdown to build a site, the process fails with:

Updating README.md
Error in (function (variant = "markdown_strict", preserve_yaml = FALSE,  : 
  unused argument (html_preview = FALSE)

Currently the YAML reads:

---
output:
  md_document:
    variant: markdown_github
---

changing the YAML to instead be:

output: github_document

builds the _pkgdown_site

mixed case GH repo name makes Travis build fail

Uppercase characters in the global - REPO=$DOCKER_SER/REPO from line 5 of .travis.yml cause the build to fail with error:

invalid argument "mrecos/DistRegLMERR" for t: Error parsing reference: "mrecos/DistRegLMERR" is not a valid repository/tag: repository name must be lowercase

https://travis-ci.org/mrecos/DistRegLMERR/builds/274845050#L498

Manually changing it to lowercase allowed the build to proceed with no errors. I believe the repo name is originated here:

rrtools/R/git.R

Line 133 in 3f2d5cf

github_dummy <- list(username = "<USERNAME>", repo = "<REPO>", fullname = "<USERNAME>/<REPO>")

adding a tolower() in there somewhere could resolve the issue. Additionally, I tested to see if a lowercase repo name had any negative effect on the build where it is also used in line 25 of travis.yml. The travis build passed in both cases.

First git push in rrtools::use_github seems to be broken

In a new repository with git enabled:

> rrtools::use_github(auth_token = "1234", private = FALSE)
✔ Git is already initialized
✔ Checking title and description
✔   Title: What the Package Does (One Line, Title Case)
✔   Description: What the package does (one paragraph)
Are title and description ok?
1: Yup
2: No way
3: Uhhhh... Maybe?

Selection: 1
* Creating GitHub repository
✔ Adding GitHub remote
✔ Adding GitHub links to DESCRIPTION
* Pushing to GitHub and setting remote tracking branch
Error in git2r::push(r, "origin", "refs/heads/master", credentials = credentials) : 
  Error in 'git2r_push': error authenticating: 

The problem seems to be how git2r::push() acquires ssh credentials. Maybe it's just a user error or a problem with my system. But my ssh-agent ist running and I see no problem here.

> sessioninfo::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       Manjaro Linux               
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Berlin               
 date     2018-11-02                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source                          
 assertthat    0.2.0   2017-04-11 [1] CRAN (R 3.5.1)                  
 backports     1.1.2   2017-12-13 [1] CRAN (R 3.5.1)                  
 cli           1.0.1   2018-09-25 [1] CRAN (R 3.5.1)                  
 clisymbols    1.2.0   2017-05-21 [1] CRAN (R 3.5.1)                  
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.5.1)                  
 curl          3.2     2018-03-28 [1] CRAN (R 3.5.1)                  
 digest        0.6.18  2018-10-10 [1] CRAN (R 3.5.1)                  
 evaluate      0.12    2018-10-09 [1] CRAN (R 3.5.1)                  
 fs            1.2.6   2018-08-23 [1] CRAN (R 3.5.1)                  
 git2r         0.23.0  2018-07-17 [1] CRAN (R 3.5.1)                  
 glue          1.3.0   2018-07-17 [1] CRAN (R 3.5.1)                  
 htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.5.1)                  
 knitr         1.20    2018-02-20 [1] CRAN (R 3.5.1)                  
 Rcpp          0.12.19 2018-10-01 [1] CRAN (R 3.5.1)                  
 rmarkdown     1.10    2018-06-11 [1] CRAN (R 3.5.1)                  
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.5.1)                  
 rrtools     * 0.1.0   2018-11-02 [1] Github (nevrome/rrtools@06d2c2f)
 rstudioapi    0.8     2018-10-02 [1] CRAN (R 3.5.1)                  
 sessioninfo   1.1.0   2018-09-25 [1] CRAN (R 3.5.1)                  
 usethis       1.4.0   2018-08-14 [1] CRAN (R 3.5.1)                  
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.5.1)                  
 yaml          2.2.0   2018-07-25 [1] CRAN (R 3.5.1)                  

[1] /home/clemens/R/x86_64-pc-linux-gnu-library/3.5
[2] /usr/lib/R/library

Allow symlinks in `use_compendium()`

When initiating a new compendium with:

rrtools::use_compendium("~/path/to/new/compendium")

where ~/path/to/new is a symlink to /some/other/path, rrtools throws an error:

> rrtools::use_compendium("~/path/to/new/compendium")
Error: '/home/nfs/user.name/path/to/new' is not a directory.

However, replacing symlink with full path works:

rrtools::use_compendium("/some/other/path/compendium")

Dependencies

Does rrtools really need the complete tidyverse in Imports?

hadley/requirements

@dakni and I wrote the add_dependencies_to_description() function to search the code in the repository for package dependencies. I've just seen that @hadley started to work on a package to do exactly this. I expect it to be or at least to become more sophisticated than our function.

This issue is supposed to be a reminder that we could replace and improve our function in the future relying on hadley/requirements.

wrong figure location -- use_analysis

Hi Ben!

when I use use_analysis() the analysis folder is created, including the sudirectory figures. When knitting the plot graphics are intended to be placed there. However, they get the name figures$CHUNKNAME.$FORMAT and are placed in the paper directory.

The manual workaround to achieve the intended behavior is to change the fig.path in the setup chunk of the Rmd to fig.path = "../figures/".

I searched through the rrtools functions in order to update the code/resolve this "bug" but I don't find the location where the setup chunk is created

replace devtools with usethis

Many of the helper functions in devtools now have more user-friendly implementations in usethis (more chatty feedback in the console, colour in the messages, etc.). Should we shift to usethis::create to support rrtools::use_compendium("pkgname") and usethis::use_github instead of devtools::use_github?

Uppercase characters are not allowed in package names

create_compendium() and use_compendium() refuse to make a package with uppercase characters in the name:

> rrtools::use_compendium("LongWindedScientificAnalysis")
Error: 'LongWindedScientificAnalysis' is not a valid package name. It should:
* Contain only ASCII letters, numbers, and '.'
* Have at least two characters
* Start with a letter
* Not end with '.'
* Not contain any upper case characters

This was added f2e3b43, to ensure compatibility with travis. But I'd make the case for allowing uppercase characters:

  • R, CRAN, and GitHub all support mixed case. Only travis is a problem, but most? users won't use travis.
  • Research compendiums are more likely to have long, multi-word names than conventional packages. These are hard to parse in all-lowercase (longwindedscientificanalysis).
  • Common word separators like _ and -—which would solve the above problem—aren't allowed in R package names. . is, but most modern R style guides recommend against using it as a word separator.

A solution would be to throw a warning about the travis issue when creating a compendium with uppercase characters, rather than an error. The hard check could be moved to use_travis().

rrtools::use_analysis(location = "vignettes") function fails to set up compendiumn

Expected behavior:

  • The following code would make a vignettes/analysis/ directory with a paper.Rmd file waiting for use:
devtools::install_github("benmarwick/rrtools")
rrtools::use_compendium("rrtoolsTEST")
rrtools::use_analysis(location = "vignettes")

Actual behavior:

  • It fails in the middle of the process with some elements missing
rrtools::use_analysis(location = "vignettes")
✔ Adding bookdown to Imports
✔ Creating 'vignettes' directory and contents
✔ Creating 'vignettes'
✔ Creating 'vignettes/paper'
✔ Creating 'vignettes/figures'
✔ Creating 'vignettes/templates'
✔ Creating 'vignettes/data'
✔ Creating 'vignettes/data/raw_data'
✔ Creating 'vignettes/data/derived_data'
✔ Creating 'references.bib' from template.
Error in usethis::ui_done("Adding ", paths, " to ", file.path(directory,  : 
  unused arguments (" to ", file.path(directory, ".gitignore"))

It seems like a simple fix to update line 210 in R/infrastructure-git.R:

usethis::ui_done("Adding ", paths, " to ", file.path(directory, ".gitignore"))

`rrtools` currently lacks package management, reducing reproducibility

In brief:

  • Problem: rrtools with Dockerfile is currently reproducible, conditional upon the time one builds the Docker image that produces paper.html (or one's trust in a custom Docker container published to DockerHub (or a similar registry)).
  • (Partial) Solution: packrat (and perhaps eventually rstudio/renv?) can record the exact version of all packages and Dockerfile can reproduce that state.

Details:

A Dockerfile contains enough information to create an environment, but not enough information to reproduce an environment. Consider a Dockerfile that contains the command “install.packages(‘dplyr’)”. Following this instruction in August 2017 and again in December 2017 will result in two different Docker containers, since the current version changed. -RStudio and Docker

Error: Could not find package root.

Getting this error when I use:

rrtools::use_analysis()

setting value
version R version 3.4.1 (2017-06-30)
system x86_64, mingw32
ui RStudio (1.0.153)
language (EN)
collate English_United States.1252
tz Africa/Johannesburg
date 2017-07-28

Packages ------------------------------------------------------------------------------
package * version date source
backports 1.1.0 2017-05-22 CRAN (R 3.4.0)
base * 3.4.1 2017-06-30 local
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
compiler 3.4.1 2017-06-30 local
curl 2.8.1 2017-07-21 CRAN (R 3.4.1)
datasets * 3.4.1 2017-06-30 local
devtools * 1.13.2 2017-06-02 CRAN (R 3.4.0)
digest 0.6.12 2017-01-27 CRAN (R 3.4.0)
evaluate 0.10.1 2017-06-24 CRAN (R 3.4.0)
ggplot2 2.2.1 2016-12-30 CRAN (R 3.4.0)
git2r 0.19.0 2017-07-19 CRAN (R 3.4.1)
graphics * 3.4.1 2017-06-30 local
grDevices * 3.4.1 2017-06-30 local
grid 3.4.1 2017-06-30 local
gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0)
httr 1.2.1 2016-07-03 CRAN (R 3.4.0)
knitr 1.16 2017-05-18 CRAN (R 3.4.0)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.0)
magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
methods * 3.4.1 2017-06-30 local
munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
Rcpp 0.12.12 2017-07-15 CRAN (R 3.4.1)
rlang 0.1.1 2017-05-18 CRAN (R 3.4.0)
rmarkdown 1.6 2017-06-15 CRAN (R 3.4.0)
rprojroot 1.2 2017-01-16 CRAN (R 3.4.0)
rrtools 0.1.0 2017-07-28 Github (b9cf7f1)
rstudioapi 0.6.0.9000 2017-07-28 Github (rstudio/rstudioapi@41dfa7f)
scales 0.4.1 2016-11-09 CRAN (R 3.4.0)
stats * 3.4.1 2017-06-30 local
stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.0)
tibble 1.3.3 2017-05-29 Github (tidyverse/tibble@b2275d5)
tools 3.4.1 2017-06-30 local
utils * 3.4.1 2017-06-30 local
whisker 0.3-2 2013-04-28 CRAN (R 3.4.0)
withr 1.0.2 2016-06-20 CRAN (R 3.4.0)

Generate README references using .bib

Should the references cited in the README get auto-generated from a references.bib file? It seems odd to advocate for that approach and then not use it, but perhaps I'm missing something?

I think this would require moving the Contributing section ahead of the references, unless there's a way to generate the references somewhere other than the end of the file?

Package installation issue on Windows

I get an error when trying to install this specific repo (I tried for wordcountaddin and it works).

> devtools::install_github("benmarwick/rrtools")
Downloading GitHub repo benmarwick/rrtools@master
√  checking for file 'C:\Users\Matthew\AppData\Local\Temp\RtmpSiOQXr\remotes449cbac15fc\benmarwick-rrtools-d52ebf1/DESCRIPTION' (414ms)
-  preparing 'rrtools': (427ms)
√  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 'rrtools/analysis'
-  building 'rrtools_0.1.0.tar.gz'
   
Installing package into ‘C:/Users/Matthew/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'rrtools' ...
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'rrtools'
    finding HTML links ... done
    add_dependencies_to_description         html  
    as.package                              html  
    check_dep_version                       html  
    create_compendium                       html  
    github_pat                              html  
    is.package                              html  
    package_file                            html  
    parse_deps                              html  
    use_analysis                            html  
    use_build_ignore                        html  
    use_circleci                            html  
    use_compendium                          html  
    use_dockerfile                          html  
    use_git                                 html  
    use_git_hook                            html  
    use_git_quietly                         html  
    use_github                              html  
    use_github_links                        html  
    use_readme_rmd                          html  
    use_travis                              html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'rrtools':
 .onAttach failed in attachNamespace() for 'rrtools', details:
  call: get(name, envir = asNamespace(pkg), inherits = FALSE)
  error: object 'field' not found
Error: loading failed
Execution halted
*** arch - x64
Error: package or namespace load failed for 'rrtools':
 .onAttach failed in attachNamespace() for 'rrtools', details:
  call: get(name, envir = asNamespace(pkg), inherits = FALSE)
  error: object 'field' not found
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/Matthew/Documents/R/win-library/3.5/rrtools'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/Matthew/AppData/Local/Temp/RtmpSiOQXr/file449c786c3c93/rrtools_0.1.0.tar.gz’ had non-zero exit status

Here's my environment:

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         rstudioapi_0.10    magrittr_1.5       usethis_1.4.0.9000 devtools_2.0.1    
 [6] pkgload_1.0.2      R6_2.4.0           rlang_0.3.3        tools_3.5.2        pkgbuild_1.0.3    
[11] sessioninfo_1.1.1  cli_1.1.0          withr_2.1.2        remotes_2.0.2      assertthat_0.2.1  
[16] digest_0.6.18      rprojroot_1.3-2    crayon_1.3.4       processx_3.3.0     callr_3.2.0       
[21] fs_1.2.7           ps_1.3.0           curl_3.3           testthat_2.0.1     memoise_1.1.0.9000
[26] glue_1.3.1         compiler_3.5.2     desc_1.2.0         backports_1.1.3    prettyunits_1.0.2 

Docum. is outdated: update README: usethis::use_mit_license()

This is only a tiny problem, too small for a pull request.

The documentation/README.md seems to be outdated here.

Please consider updating the README.md file:

usethis::use_mit_license(copyright_holder = "my name")

Error in usethis::use_mit_license(copyright_holder = "my name") : 
  unused argument (copyright_holder = "my name")

With

usethis::use_mit_license(name = "My Name")

Result:

✔ Setting License field in DESCRIPTION to 'MIT + file LICENSE'
✔ Writing 'LICENSE.md'
✔ Adding '^LICENSE\.md$' to '.Rbuildignore'
✔ Writing 'LICENSE'

I also think step 3 (devtools::use_github(...)) should be marked as optional, maybe in a subtle way. Uploading the repo to github early might pollute the github account with incomplete repositories and package stubs. This is just my personal opinion.

Also, a bulletpoint could be added (to step 3) that all subtasks of step 1 must be completed otherwise the uploader will croak.

topic 5 contains a typo:

"vingettes" to create a "vingettes/"

(the rrtools::use_analysis( location = "vignettes") call works properly, though)

ERROR: installing package DESCRIPTION failed for package 'rrtools'

devtools::install_github("benmarwick/rrtools")
Downloading GitHub repo benmarwick/rrtools@master
from URL https://api.github.com/repos/benmarwick/rrtools/zipball/master
Installing rrtools
"C:/PROGRA1/R/R-341.2/bin/x64/R" --no-site-file --no-environ
--no-save --no-restore --quiet CMD INSTALL
"C:/Users/Jinn-Yuh/AppData/Local/Temp/RtmpwZgVAC/devtools2fb0eca7ba1/benmarwick-rrtools-45c4a9b"
--library="D:/Dropbox/Stat/R/Library" --install-tests

  • installing source package 'rrtools' ...
    Error in parse(con, encoding = "UTF-8") :
    invalid multibyte character in parser at line 4
    ERROR: installing package DESCRIPTION failed for package 'rrtools'
  • removing 'D:/Dropbox/Stat/R/Library/rrtools'
    Installation failed: Command failed (1)

Add unit tests

We should have unit tests for the core functions in this package and their variants.

This will be a bit different from usual tests because they output files and directories, and some do things on other services that we may not be able to do with Travis.

Page breaking in the paper.Rmd file

There are requirements by some of the journals to provide tables on separate pages. Is it possible to do in the Rmarkdown file?

I have noticed people using Heading 5 (#####) with the paragraph style performing a page break but I find it a bit hacky.

Is there a better solution to this issue? maybe also one that does not require shady-Haskell-recompilation of the pandoc filters??

use_circleci

Looks like this can do CI on private GitHub repos for free, unlike Travis, so that is an option we want here too.

codemeta json for compendia

I heard recently that rOpenSci will soon be asking for codemeta.json metadata for submissions to their family of packages. They may be able to simplify this with a new function usethis::use_codemeta() which would use https://github.com/ropensci/codemetar. This metadata format is widely accepted by many trustworthy repositories.

We might want to consider this too. Perhaps we could auto-generate this json file during rrtools::use_analysis() or some other point after the DESCRIPTION is well-populated? And then prompt the user to update it later maybe?

Add a one-liner meta-function

I had some feedback from @clanfear that it would be useful to have a single function that combines most of the steps. Like a meta-function. We could have 2-3 main options, e.g.

  • a very basic, lightweight compendium suitable for student assignments,
  • a more elaborate one, and then
  • the kitchen sink with CI and docker for example.

I think this meta-function could be useful in workshop lessons where we don't have time to review every step in detail, but where we want to give a quick taste of how to do reproducibile research easily.

What do you think?

[enhancement] Use templates for standardized reporting guidelines

Many scientific reports have specific structures.

Original articles, RCTs, literature reviews and case reports are distinctly different papers.

Whenever one would start writing - it is necessary to make a structure of a specific type.
Moreover, there are multiple guidelines how to efficiently (and by standardized matter) write a specific report.

So let's say I would like to write a Case report in a medical journal.
The http://www.equator-network.org/ page provides the guidelines on how to write various scientific manuscripts and which information needs to be in these reports. They also recommend the best set of guidelines for the job.

We find that for the case reports the CARE guidelines are recommended.
http://www.equator-network.org/reporting-guidelines/care/
Therefore we would like to write a case report using these guidelines. They provide a set of tips and checklists while writing. But finding them and using them could be easier.

I have just started writing a package that is meant to be an extension to the rrtools by providing these guidelines as templates 'paper.Rmd' file.

There is, of course, a ton of work to be done to make all of these guidelines available.

Please let me know what you think - if this is useful, and if you see a method to simplify the template creation process by maybe scraping the equator webpage?

the package (with only one template right now) can be found here: https://github.com/wolass/reportingGuidelines

The only way to use it right now is to start a repository using rrtools and use_analysis(). After that the function reportingGuidelines::useGuideline("case") will replace the paper.Rmd file with a CARE_statement template.

The template has the tips and checklist items included in it - to provide a thorough reference while writing the report. So no need to lookup the EQUATOR webpage, download the templates yourself and get back to R. It is all in one place.

rOpenSci review and CRAN release

Although installing from GitHub using devtools works fine, it would be mildly more convenient, and more familiar to newer R users, to install it the standard way from CRAN. This package seems fairly mature, is a CRAN release planned?

Scanning through issues I can find one that would hold up a CRAN release:

  • #70: The use of unexported/internal functions called via ::: is not allowed by CRAN

Any others?

custom knit to update DESCRIPTION Imports during knitting

In e235c44 I have tried to over-ride the knit button to trigger a function that scans the Rmd for library() etc. calls, and update the DESCRIPTION Imports with the names of all the packages used in the Rmd. I often get tripped up because I forget to add those, so I'm looking for a way to automate this.

I have added a line to the YAML in paper.Rmd, and a new function knit_and_update_desc_imports to try and do this. It works, but only if we import packrat, which I don't want to do.

The problem is that I cannot exactly duplicate the key function for scanning the Rmd, packrat:::fileDependencies. I have tried to copy in all the relevant code from packrat, to avoid the dependency (because that gives warnings with devtools). But still I cannot make my local fileDependencies work, only packrat:::fileDependencies works.

I would like your feedback on (1) if this is a good idea and (2) how to make the local fileDependencies work without using packrat.

I have also directly copied in a lot of code from devtools so we don't have to use ::: at all anymore. That gets rid of a bunch of warnings.

use_analysis function and pkg path

I ran into this issue because I am testing the "RStudio-free" Version of rrtools.

When calling

rrtools::use_analysis()

I receive this output

* Adding bookdown to Imports
Next: 
 * Write your article/paper/thesis in Rmd file(s) in analysis/paper/
 * Add the citation style libray file (csl) to replace the default in analysis/paper/
 * Add reference details to the references.bib in analysis/paper/
 * For adding captions & cross-referenceing in an Rmd, see https://bookdown.org/yihui/bookdown/ 
 * For adding citations & reference lists in an Rmd, see http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html 

Besides all files are created as expected. Nice.

However, when calling

rrtools::use_analysis(pkg = "MyPackage")

I receive this error

* Adding bookdown to Imports
Error in file.copy(from = list.files(system.file("templates/word_templates/",  : 
  more 'from' files than 'to' files

Why is it not possible to state the pkgpath explicitly? My current attempts failed (I suspect a problem with

Besides the "bug", I think this is a somewhat important issue because IMO it is not good to rely too much on the automagic of RStudio...in this case its automatic changing of the working directory when creating a package.

My workaround looks like this (ugly, I know...):

use_analysis <- function(pkg = ".", template = 'paper.Rmd') {
  if (pkg != ".") {
    setwd(pkg)
    ugly <- TRUE
    pkg <- "."
  }

...

if (ugly == TRUE) {
    setwd("..")
}
  
invisible(TRUE)
}

allegedly missing documentation entries: use_analysis

We get this weird warning in the R package check.

Status: 1 WARNING
checking for missing documentation entries ... WARNING
Undocumented code objects:
  ‘use_analysis’
All user-level objects in a package should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.

use_analysis() is of course documented. There's a stackoverflow thread that discusses a similar problem. Maybe this could be fixed by changing the function name, but I hope for a more elegant solution.

@benmarwick I'm pretty sure that we already discussed about this some months ago. But maybe it's good to have an open bug report to keep this in mind. It's not an important issue, but mildly unsatisfying.

The use of unexported/internal functions called via ::: is not allowed by CRAN

We get a new NOTE in the check results:

* checking dependencies in R code ... NOTE
Unexported objects imported by ':::' calls:
  ‘usethis:::done’ ‘usethis:::field’ ‘usethis:::git_uncommitted’
  ‘usethis:::todo’ ‘usethis:::value’
  See the note in ?`:::` about the use of this operator.

We have four options to deal with this:

  1. Ignore it. A CRAN release would be difficult though.
  2. Contact the usethis package authors and ask them to export these functions.
  3. Copy the function source code (and cite the author).
  4. This nasty workaround: https://stat.ethz.ch/pipermail/r-devel/2013-August/067210.html

Template path incorrect

In the paper.Rmd file the path to the template file is wrong.

it should be ../templates/template.docx

[Question] How do I access an object stored in the package from the paper.RMD file?

Hi I figured that the files are nicely saving in the directories (all scripts in R folder and figures where they are supposed to!) Thats great.

So next thing that occured to me is that I do not need to call every script per source() function in the paper.Rmd file. I only need to call the package here! That's great too!

My question is now can I call a variable that was created in the R/analysis.R script to be evaluated in the paper.Rnw file?

To illustrate R/analysis.R:

df <- data.frame(x=1,y=2)

analysis/paper/paper.Rmd

library(CREATED_PACKAGE)
paste0("There were", df$x, " events") 

The above code produces an error

I'm sure that I am missing an info how to properly build a package... any help here?

I really love this package and it has been super-helpful!!!!1
Please do not stop developing it!!!

Track changes made to the manuscript during peer review.

After submitting my first paper in DOCX generated strictly with the rrtools workflow I am now in the first revision.

The problem that occured is that whenever I am introducing changes to the manuscript these are only visible in the .RMD file (and this is perfectly fine if reviewers would use github).

Do you have any ideas how to introduce "changes tracking" in the generated manuscripts - this is often required by journals and generally a good practice to always state what has been modified from the original file.

I suppose a simple color change would be sufficient.

Is there an elegant (or at least a hackable) solution to this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.