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

(new to 5.0) @export fails to export if there is another #' before the function/object #415

Closed
ttriche opened this issue Oct 28, 2015 · 11 comments

Comments

@ttriche
Copy link

ttriche commented Oct 28, 2015

This is new. I can work around it by removing said formatting, but it seems rather brittle and flaky.

@hadley
Copy link
Member

hadley commented Oct 28, 2015

Could you please provide a reproducible example?

ttriche added a commit to ttriche/roxpkg that referenced this issue Oct 28, 2015
@ttriche
Copy link
Author

ttriche commented Oct 28, 2015

sure, see ttriche/roxpkg , specifically hello.R and goodbye.R

The comment about @export spanning more than one line seems to be new(ish) and wasn't getting thrown previously (in the package I was working on earlier), just mysteriously not exporting anything.

@hadley
Copy link
Member

hadley commented Oct 28, 2015

Could you please include a reproducible example inline?

@ttriche
Copy link
Author

ttriche commented Oct 28, 2015

How? The problem occurs when I run devtools::document() or
roxygen2::roxygenise() from within the package root.

That's also how I was most easily able to reproduce the problem. I'm not
sure how to provide an inline example of an error that seems to occur in a
context-dependent fashion. If there's a trailing #' after #' @export, the
function isn't exported. This behavior is new. That's all I'm saying.

The repo that I threw up demonstrates it in the simplest way I could think
of.

--t

On Wed, Oct 28, 2015 at 3:25 PM, Hadley Wickham notifications@github.com
wrote:

Could you please include a reproducible example inline?


Reply to this email directly or view it on GitHub
#415 (comment).

@hadley
Copy link
Member

hadley commented Oct 28, 2015

Copy and paste the code from your repo into this issue. Or at least paste a link to the file within the repo.

@ttriche
Copy link
Author

ttriche commented Oct 28, 2015

In the past, there was no difference between the following re: NAMESPACE. Now, there is.

#' Hi, I'm exported!
#'
#' @param txt       what to say
#'
#' @export
hello <- function(txt = "world") {
    cat("Hello, ", txt, "\n")
}
#' Hi, I'm not exported!
#'
#' @param txt       what to say
#'
#' @export
#'
goodbye <- function(txt = "world") {
    cat("Goodbye, ", txt, "\n")
}

@hadley hadley closed this as completed in 361c84e Oct 29, 2015
@hadley
Copy link
Member

hadley commented Oct 29, 2015

Thanks - that's helpful. The fewer links I need to follow, the faster I can fix the problem - in future, it would also be helpful if you include the text of the error message. That makes it even faster for me to track down.

@ttriche
Copy link
Author

ttriche commented Oct 29, 2015

Thanks!

--t

On Oct 29, 2015, at 6:18 AM, Hadley Wickham notifications@github.com wrote:

Closed #415 via 361c84e.


Reply to this email directly or view it on GitHub.

@alexWhitworth
Copy link

@hadley @klutometis This is still not working for me. I have to move #' @export above another roxygen2 tag to make it work. From a fresh session details below.

Intriguingly, the bug is itself buggy. That is, it doesn't reproduce consistently. For example

file1.R
#' @title ...
... blah blah ...
#' @export
foo <- function(a,b,c) {<some function>} # works fine

file2.R
#' @title ...
... blah blah ...
#' @export
foo2 <- function(a,b,c) {<some function>} # doesn't work, but 

file2.R
#' @title ...
... blah blah ...
#' @export
#' <any other roxygen tag, such as examples or reference>
foo <- function(a,b,c) {<some function>} # works fine
> devtools::document()
Updating synthACS documentation
Loading synthACS
Warning: @export [pull_synth_data.R#12]: may only span a single line
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] synthACS_1.2.5      testthat_2.0.0      data.table_1.10.4-3 acs_2.1.3           XML_3.98-1.10      
[6] stringr_1.3.0      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16     rstudioapi_0.7   xml2_1.2.0       magrittr_1.5     roxygen2_6.0.1   devtools_1.13.4 
 [7] R6_2.2.2         rlang_0.1.6      httr_1.3.1       plyr_1.8.4       tools_3.4.3      withr_2.1.1     
[13] commonmark_1.4   yaml_2.1.16      digest_0.6.15    assertthat_0.2.0 rprojroot_1.3-2  crayon_1.3.4    
[19] memoise_1.1.0    stringi_1.1.7    compiler_3.4.3   backports_1.1.2  desc_1.1.1      

@zkurtz
Copy link

zkurtz commented Sep 16, 2018

Observing the same behavior as "I have to move #' @export above another roxygen2 tag to make it work." with current version 6.1.0.9000.

@gaborcsardi
Copy link
Member

gaborcsardi commented Sep 16, 2018

@zkurtz commenting on closed issues usually will not get you very far. Can you please open a new issue with a reproducible example? Or some of the examples above fail for you?

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