Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usethis::use_pipe() gives .Rd warning #478

Closed
IndrajeetPatil opened this issue Oct 5, 2018 · 15 comments
Closed

usethis::use_pipe() gives .Rd warning #478

IndrajeetPatil opened this issue Oct 5, 2018 · 15 comments

Comments

@IndrajeetPatil
Copy link

After using usethis::use_pipe() in my R package, roxygen2::roxygenize() has started producing the following warning:

file link '%>%' in package 'magrittr' does not exist and so has been treated as a topic

How can I get rid of it? Or, even better, is there any way that the usethis function can be modified so that it produces the roxygen template for %>% that doesn't produce this warning?

@kdaily
Copy link

kdaily commented Oct 5, 2018

Had this happen too. I first could not follow the suggested instructions of running devtools::document() after usethis::use_pipe() - RStudio would crash completely. The only way I could run it is in a command line R session, after which I receive the same warning when running devtools::document().

@jennybc
Copy link
Member

jennybc commented Oct 6, 2018

Can either of you provide a clean reprex? I can't reproduce your problem.

Using the current dev version of usethis (1e3c6a6):

I execute usethis::create_package("~/tmp/zzz").
In the new package zzz, I see this:

> use_roxygen_md()
✔ Setting active project to '/Users/jenny/tmp/zzz'Setting Roxygen field in DESCRIPTION to 'list(markdown = TRUE)'Setting RoxygenNote field in DESCRIPTION to '6.1.0'Run `devtools::document()`
> use_pipe()
✔ Adding 'magrittr' to Imports field in DESCRIPTIONWriting 'R/utils-pipe.R'Run `devtools::document()`
> devtools::document()
Updating zzz documentation
Writing NAMESPACE
Loading zzz
Writing NAMESPACE
Writing pipe.Rd

Here's my version of devtools and roxygen2:

 devtools    * 1.13.6.9000 2018-10-06 [1] Github (r-lib/devtools@c24b146)   
roxygen2     6.1.0       2018-07-27 CRAN (R 3.5.0)   

@IndrajeetPatil
Copy link
Author

Huh, if I try to do a reprex, I don't get any warning in the reprex.

setwd("~/sentiwordcloud")

usethis::use_roxygen_md()
#> <U+2714> Setting active project to 'C:/Users/inp099/Documents/sentiwordcloud'
#> Error: Package 'roxygen2md' required. Please install before re-trying.

usethis::use_pipe()
#> <U+25CF> Run `devtools::document()`

devtools::document()
#> Updating sentiwordcloud documentation
#> Writing NAMESPACE
#> Loading sentiwordcloud
#> Writing NAMESPACE

devtools::document(roclets = c('rd', 'collate', 'namespace'))
#> Updating sentiwordcloud documentation
#> Writing NAMESPACE
#> Loading sentiwordcloud
#> Writing NAMESPACE

Created on 2018-10-05 by the reprex package (v0.2.1)

But I still get this warning in my local session.

image

Here is my session info:

options(width = 200)
devtools::session_info()
#> - Session info ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.5.1 (2018-07-02)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/New_York            
#>  date     2018-10-05                  
#> 
#> - Packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#>  package     * version     date       lib source                            
#>  assertthat    0.2.0       2017-04-11 [1] CRAN (R 3.5.0)                    
#>  backports     1.1.2       2017-12-13 [1] CRAN (R 3.5.0)                    
#>  base64enc     0.1-3       2015-07-28 [1] CRAN (R 3.5.0)                    
#>  callr         3.0.0       2018-08-24 [1] CRAN (R 3.5.1)                    
#>  cli           1.0.1       2018-09-25 [1] CRAN (R 3.5.1)                    
#>  crayon        1.3.4       2018-09-26 [1] Github (r-lib/crayon@3e751fb)     
#>  debugme       1.1.0       2017-10-22 [1] CRAN (R 3.5.0)                    
#>  desc          1.2.0       2018-05-01 [1] CRAN (R 3.5.0)                    
#>  devtools      1.13.6.9000 2018-09-23 [1] Github (r-lib/devtools@74df201)   
#>  digest        0.6.17      2018-09-12 [1] CRAN (R 3.5.1)                    
#>  evaluate      0.11        2018-07-17 [1] CRAN (R 3.5.1)                    
#>  fs            1.2.6       2018-08-23 [1] CRAN (R 3.5.1)                    
#>  glue          1.3.0       2018-09-17 [1] Github (tidyverse/glue@4e74901)   
#>  htmldeps      0.1.1       2018-09-17 [1] Github (rstudio/htmldeps@c1023e0) 
#>  htmltools     0.3.6       2017-04-28 [1] CRAN (R 3.5.0)                    
#>  knitr         1.20.12     2018-08-13 [1] local                             
#>  magrittr      1.5         2014-11-22 [1] CRAN (R 3.5.0)                    
#>  memoise       1.1.0       2017-04-21 [1] CRAN (R 3.5.0)                    
#>  pkgbuild      1.0.1.9000  2018-10-01 [1] Github (r-lib/pkgbuild@446d70c)   
#>  pkgload       1.0.0       2018-09-17 [1] Github (r-lib/pkgload@7771d78)    
#>  prettyunits   1.0.2       2015-07-13 [1] CRAN (R 3.5.0)                    
#>  processx      3.2.0       2018-08-16 [1] CRAN (R 3.5.1)                    
#>  ps            1.1.0       2018-08-10 [1] CRAN (R 3.5.1)                    
#>  R6            2.3.0       2018-10-04 [1] CRAN (R 3.5.1)                    
#>  Rcpp          0.12.19     2018-10-01 [1] CRAN (R 3.5.1)                    
#>  remotes       1.1.1.9000  2018-09-23 [1] Github (r-lib/remotes@5a07ad2)    
#>  rlang         0.2.2       2018-08-16 [1] CRAN (R 3.5.1)                    
#>  rmarkdown     1.10.13     2018-09-17 [1] Github (rstudio/rmarkdown@df4ec91)
#>  rprojroot     1.3-2       2018-01-03 [1] CRAN (R 3.5.0)                    
#>  sessioninfo   1.1.0       2018-09-25 [1] CRAN (R 3.5.1)                    
#>  stringi       1.2.4       2018-07-20 [1] CRAN (R 3.5.1)                    
#>  stringr       1.3.1       2018-05-10 [1] CRAN (R 3.5.0)                    
#>  testthat      2.0.0       2017-12-13 [1] CRAN (R 3.5.0)                    
#>  usethis       1.4.0.9000  2018-09-23 [1] Github (r-lib/usethis@1e3c6a6)    
#>  withr         2.1.2       2018-03-15 [1] CRAN (R 3.5.0)                    
#>  xfun          0.3         2018-07-06 [1] CRAN (R 3.5.1)                    
#>  yaml          2.2.0       2018-07-25 [1] CRAN (R 3.5.1)                    
#> 
#> [1] C:/Users/inp099/Documents/R/win-library/3.5
#> [2] C:/Program Files/R/R-3.5.1/library

Created on 2018-10-05 by the reprex package (v0.2.1)

@kdaily
Copy link

kdaily commented Oct 8, 2018

> usethis::create_package("usethisissue478") # restarts R normally
> usethis::use_roxygen_md()
✔ Setting active project to '/home/kdaily/scratch/usethisissue478'
✔ Setting Roxygen field in DESCRIPTION to 'list(markdown = TRUE)'
✔ Setting RoxygenNote field in DESCRIPTION to '6.1.0'
● Run `devtools::document()`
> devtools::document()
Updating usethisissue478 documentation
Loading usethisissue478
Writing NAMESPACE
> usethis::use_pipe()
✔ Adding 'magrittr' to Imports field in DESCRIPTION
✔ Writing 'R/utils-pipe.R'
● Run `devtools::document()`
> devtools::document()
Updating usethisissue478 documentation
Loading usethisissue478

results in RStudio modal popup:

R Session Aborted
R encountered a fatal error.
The session was terminated.

I started a new R session and re-created the package (using only usethis::create_package("usethisissue478"). After reloading, this was my sessionInfo:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 27 (Workstation Edition)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0    yaml_2.1.19   

I have usethis 1.4.0, magrittr 1.5, and RStudio 1.1.383.

@jennybc
Copy link
Member

jennybc commented Oct 8, 2018

Can you both report what version of roxygen2 you have?

@kdaily
Copy link

kdaily commented Oct 8, 2018

I have roxygen2 6.1.0.

@IndrajeetPatil
Copy link
Author

I have:

roxygen2 6.1.0.9000
roxygen2md 0.0.4.9000

@IndrajeetPatil
Copy link
Author

This doesn't solve the issue, but shouldn't \code{magrittr::\link[magrittr]{\%>\%}} here be \code{\link[magrittr]{\%>\%}} ?

#' Pipe operator
#'
#' See \code{magrittr::\link[magrittr]{\%>\%}} for details.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
NULL

The same also holds true for the roxygen template created by usethis::use_tibble().

@jennybc
Copy link
Member

jennybc commented Nov 5, 2018

No, I think the text and link are what we want them to be.

screen shot 2018-11-05 at 8 22 21 am

@IndrajeetPatil
Copy link
Author

Hmm, this doesn't seem specific to the pipe operator. For example, if re-export some of the tidyverse operators-

#' @export
#' @importFrom rlang "%||%"
rlang::`%||%`

#' @export
#' @importFrom rlang "%|%"
rlang::`%|%`

#' @export
#' @importFrom magrittr "%>%"
magrittr::`%>%`

#' @export
#' @importFrom magrittr "%<>%"
magrittr::`%<>%`

#' @export
#' @importFrom magrittr "%$%"
magrittr::`%$%`

All of these provide warnings during devtools::check():

Rd warning: C:/Users/inp099/Documents/ggstatsplot/man/reexports.Rd:22: file link '%>%' in package 'magrittr' does not exist and so has been treated as a topic
Rd warning: C:/Users/inp099/Documents/ggstatsplot/man/reexports.Rd:22: file link '%<>%' in package 'magrittr' does not exist and so has been treated as a topic
Rd warning: C:/Users/inp099/Documents/ggstatsplot/man/reexports.Rd:22: file link '%$%' in package 'magrittr' does not exist and so has been treated as a topic
Rd warning: C:/Users/inp099/Documents/ggstatsplot/man/reexports.Rd:24: file link '%||%' in package 'rlang' does not exist and so has been treated as a topic

So maybe the issue is with roxygen2 and how it is handling operators with unusual names?

@hadley
Copy link
Member

hadley commented Nov 24, 2018

This is not a usethis problem, but is somehow related to your version of R. The warning can be ignored.

@hadley hadley closed this as completed Nov 24, 2018
@kdaily
Copy link

kdaily commented Nov 26, 2018

@hadley is there somewhere else I should report this? This crashes RStudio for me (see #478 (comment)). Thanks!

@hadley
Copy link
Member

hadley commented Nov 26, 2018

I doubt that is the source of the crash. Maybe start in community.rstudio.com?

@kdaily
Copy link

kdaily commented Nov 26, 2018

Will do. Thanks!

@MikeBadescu
Copy link

I believe the issue can be solved temporarily by modifying the doc string from

#' See \code{magrittr::\link[magrittr]{\%>\%}} for details.

to

#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.

The reason is that we need to indicate the .Rd file name (in this case pipe) that contains the topic %>%. See also r-lib/roxygen2#707

ramiromagno added a commit to ramiromagno/gwasrapidd that referenced this issue Jun 5, 2019
The build on Windows was giving me trouble with
certain doc links, the pipe operator was one of them:
https://bioconductor.org/spb_reports/gwasrapidd_buildreport_20190605094324.html#tokay1_check_anchor.
So I am making this change as suggested here:
r-lib/usethis#478 (comment).
ryantimpe added a commit to ryantimpe/brickr that referenced this issue Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants