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

The first function is documented but the following is not found #28

Open
martincadek opened this issue Nov 26, 2020 · 2 comments · May be fixed by #29
Open

The first function is documented but the following is not found #28

martincadek opened this issue Nov 26, 2020 · 2 comments · May be fixed by #29

Comments

@martincadek
Copy link

martincadek commented Nov 26, 2020

I am experiencing issue where only the first function that is loaded is rendered in documentation, however, any functions following are not found.

Thank you for any help you can provide.

The session info:

Click to expand example of the Session Info
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

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

other attached packages:
 [1] TempPackage_1.0   docstring_1.0.0   vroom_1.3.2       GGally_2.0.0     
 [5] viridis_0.5.1     viridisLite_0.3.0 flextable_0.5.11  funModeling_1.9.4
 [9] Hmisc_4.4-1       Formula_1.2-4     survival_3.2-7    lattice_0.20-41  
[13] patchwork_1.1.0   janitor_2.0.1     here_0.1          writexl_1.3.1    
[17] readxl_1.3.1      forcats_0.5.0     stringr_1.4.0     dplyr_1.0.2      
[21] purrr_0.3.4       readr_1.4.0       tidyr_1.1.2       tibble_3.0.4     
[25] ggplot2_3.3.2     tidyverse_1.3.0  

loaded via a namespace (and not attached):
 [1] colorspace_1.4-1    ellipsis_0.3.1      rprojroot_1.3-2     snakecase_0.11.0   
 [5] htmlTable_2.1.0     base64enc_0.1-3     fs_1.5.0            rstudioapi_0.12    
 [9] roxygen2_7.1.1      bit64_4.0.5         fansi_0.4.1         lubridate_1.7.9    
[13] xml2_1.3.2          splines_4.0.3       knitr_1.30          pkgload_1.1.0      
[17] jsonlite_1.7.1      entropy_1.2.1       broom_0.7.2         cluster_2.1.0      
[21] dbplyr_2.0.0        png_0.1-7           compiler_4.0.3      httr_1.4.2         
[25] backports_1.2.0     assertthat_0.2.1    Matrix_1.2-18       lazyeval_0.2.2     
[29] cli_2.1.0           prettyunits_1.1.1   htmltools_0.5.0     tools_4.0.3        
[33] gtable_0.3.0        glue_1.4.2          reshape2_1.4.4      Rcpp_1.0.5         
[37] cellranger_1.1.0    vctrs_0.3.4         xfun_0.19           ps_1.4.0           
[41] testthat_3.0.0      rvest_0.3.6         lifecycle_0.2.0     scales_1.1.1       
[45] hms_0.5.3           RColorBrewer_1.1-2  gridExtra_2.3       pander_0.6.3       
[49] gdtools_0.2.2       rpart_4.1-15        reshape_0.8.8       latticeExtra_0.6-29
[53] stringi_1.5.3       desc_1.2.0          checkmate_2.0.0     pkgbuild_1.1.0     
[57] zip_2.1.1           rlang_0.4.8         pkgconfig_2.0.3     systemfonts_0.3.2  
[61] moments_0.14        evaluate_0.14       ROCR_1.0-11         htmlwidgets_1.5.2  
[65] processx_3.4.4      bit_4.0.4           tidyselect_1.1.0    plyr_1.8.6         
[69] magrittr_1.5        R6_2.5.0            generics_0.1.0      DBI_1.1.0          
[73] pillar_1.4.6        haven_2.3.1         foreign_0.8-80      withr_2.3.0        
[77] nnet_7.3-14         modelr_0.1.8        crayon_1.3.4        uuid_0.1-4         
[81] rmarkdown_2.5       officer_0.3.15      jpeg_0.1-8.1        grid_4.0.3         
[85] data.table_1.13.2   callr_3.5.1         reprex_0.3.0        digest_0.6.27      
[89] munsell_0.5.0   

> RStudio.Version()
$citation

To cite RStudio in publications use:

  RStudio Team (2020). RStudio: Integrated Development Environment for R.
  RStudio, PBC, Boston, MA URL http://www.rstudio.com/.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {RStudio: Integrated Development Environment for R},
    author = {{RStudio Team}},
    organization = {RStudio, PBC},
    address = {Boston, MA},
    year = {2020},
    url = {http://www.rstudio.com/},
  }


$mode
[1] "desktop"

$version
[1] ‘1.4.1048’

$release_name
[1] "Wax Begonia"

Please see below how this looks like for the Issue 1:

Click to expand example of the Issue 1
Attaching package: ‘docstring’

The following object is masked from ‘package:utils’:

    ?

> label_function1 <- function(string) {
+      
+      #' Labeller function.
+      #'
+      #' @description Default function used as part of faceting that is passed into labeller function.
+      #'
+      #' @param string  String of title.
+      #' @usage Create labels.
+      #' @note Uses: TO-DO.
+      #' @examples
+      #' TO-DO
+      #' @author Martin Cadek November 2020
+      string <- str_replace_all(string, "_", " ")
+      string <- str_to_title(string)
+      string
+ }
> 
> label_function2 <- function(string) {
+      
+      #' Labeller function.
+      #'
+      #' @description Default function used as part of faceting that is passed into labeller function.
+      #'
+      #' @param string  String of title.
+      #' @usage Create labels.
+      #' @note Uses: TO-DO.
+      #' @examples
+      #' TO-DO
+      #' @author Martin Cadek November 2020
+      string <- str_replace_all(string, "_", " ")
+      string <- str_to_title(string)
+      string
+ }
> 
> ?label_function1
> ?label_function2
No documentation for ‘label_function2’ in specified packages and libraries:
you could try ‘??label_function2’

This is the output of the documentation in the Issue 1:

Click to expand example output from the Issue 1
label_function1 {TempPackage}	R Documentation
Labeller function.
Description
Default function used as part of faceting that is passed into labeller function.

Usage
Create labels.
Arguments
string	
String of title.

Note
Uses: TO-DO.

Author(s)
Martin Cadek November 2020

Examples
TO-DO

Here's the same example but the function order is reversed:

Click to expand example of the Issue 2
Attaching package: ‘docstring’

The following object is masked from ‘package:utils’:

    ?

> label_function1 <- function(string) {
+      
+      #' Labeller function.
+      #'
+      #' @description Default function used as part of faceting that is passed into labeller function.
+      #'
+      #' @param string  String of title.
+      #' @usage Create labels.
+      #' @note Uses: TO-DO.
+      #' @examples
+      #' TO-DO
+      #' @author Martin Cadek November 2020
+      string <- str_replace_all(string, "_", " ")
+      string <- str_to_title(string)
+      string
+ }
> 
> label_function2 <- function(string) {
+      
+      #' Labeller function.
+      #'
+      #' @description Default function used as part of faceting that is passed into labeller function.
+      #'
+      #' @param string  String of title.
+      #' @usage Create labels.
+      #' @note Uses: TO-DO.
+      #' @examples
+      #' TO-DO
+      #' @author Martin Cadek November 2020
+      string <- str_replace_all(string, "_", " ")
+      string <- str_to_title(string)
+      string
+ }
> 
> # Reverse
> ?label_function2
> ?label_function1
No documentation for ‘label_function1’ in specified packages and libraries:
you could try ‘??label_function1’
@ZacharyWaller ZacharyWaller linked a pull request Jul 15, 2021 that will close this issue
@Fred-Wu
Copy link

Fred-Wu commented Jul 26, 2022

This is an easy fix in the pull request. Hope it can be granted to fix the issue.

@TomCodd
Copy link

TomCodd commented Nov 21, 2022

I'm also having this issue exactly - also doesn't work when different functions from different scripts are called; only one docstring is "live" at the time. I've had a look at the temp folders created in windows, and can see only one Rd file at a time - for example, if I have a script that contains two functions with docstrings, and I run the script, one of the docstrings will appear in the temporary folder. If I then do docstring([other_function]) the .Rd that was in the temporary folder for the first function is deleted, and replaced with an .Rd file for the [other_function].

EDIT: To be clear, this is a problem when trying to do ?[other_function], docstring() still works, but isn't as intuitive, which is important when I'm trying to teach people to document their code this way when they aren't used to it

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

Successfully merging a pull request may close this issue.

3 participants