├── R ├── rrtools.addin.R ├── tests_server.R ├── readme_server.R ├── general_helper_functions.R ├── ci_cd_server.R ├── license_server.R ├── virtualisation_server.R ├── file_structure_server.R ├── setup_server.R ├── tests_ui.R ├── readme_ui.R ├── ci_cd_ui.R ├── virtualisation_ui.R ├── license_ui.R ├── rrtools_assistant.R ├── file_structure_ui.R └── setup_ui.R ├── .Rbuildignore ├── inst ├── image │ ├── overview.png │ └── overview.svg ├── gif │ └── rrtools_addin_demo.gif ├── rstudio │ └── addins.dcf └── style │ └── rrtools_assistant_stylesheet.css ├── NAMESPACE ├── NEWS.md ├── rrtools.addin.Rproj ├── README.md ├── man ├── rrtools_assistant.Rd └── rrtools.addin-package.Rd ├── .travis.yml ├── .gitignore ├── DESCRIPTION ├── LICENSE └── README.Rmd /R/rrtools.addin.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | ^README\.Rmd$ 5 | -------------------------------------------------------------------------------- /inst/image/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/rrtools.addin/master/inst/image/overview.png -------------------------------------------------------------------------------- /inst/gif/rrtools_addin_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevrome/rrtools.addin/master/inst/gif/rrtools_addin_demo.gif -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(rrtools_assistant) 4 | importFrom(magrittr,"%>%") 5 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | - V0.2.2: Updated fontawesome icon names to avoid warnings in the console 2 | - V0.2.1: Removed references to deprecated function `rrtools::use_travis` 3 | -------------------------------------------------------------------------------- /inst/rstudio/addins.dcf: -------------------------------------------------------------------------------- 1 | Name: rrtools Assistant 2 | Description: GUI tool to work with the rrtools functions 3 | Binding: rrtools_assistant 4 | Interactive: true 5 | -------------------------------------------------------------------------------- /R/tests_server.R: -------------------------------------------------------------------------------- 1 | tests_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run, { 4 | 5 | rstudioapi::sendToConsole("usethis::use_testthat()") 6 | 7 | shiny::stopApp() 8 | 9 | }) 10 | 11 | } 12 | -------------------------------------------------------------------------------- /R/readme_server.R: -------------------------------------------------------------------------------- 1 | readme_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run_readme, { 4 | 5 | rstudioapi::sendToConsole("rrtools::use_readme_rmd()") 6 | 7 | shiny::stopApp() 8 | 9 | }) 10 | 11 | } 12 | -------------------------------------------------------------------------------- /R/general_helper_functions.R: -------------------------------------------------------------------------------- 1 | extract_help_as_html <- function(pkg, fn = NULL) { 2 | rdbfile <- file.path(find.package(pkg), "help", pkg) 3 | rdb <- utils::getFromNamespace("fetchRdDB", "tools")(rdbfile, key = fn) 4 | convertor <- tools::Rd2HTML 5 | f <- function(x) utils::capture.output(convertor(x)) 6 | if(is.null(fn)) lapply(rdb, f) else f(rdb) 7 | } 8 | -------------------------------------------------------------------------------- /rrtools.addin.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | PackageRoxygenize: rd,collate,namespace 21 | -------------------------------------------------------------------------------- /R/ci_cd_server.R: -------------------------------------------------------------------------------- 1 | ci_cd_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run, { 4 | 5 | docker_param <- switch( 6 | input$docker_selection, 7 | Yes = TRUE, 8 | No = FALSE 9 | ) 10 | 11 | rstudioapi::sendToConsole( 12 | paste0( 13 | "rrtools::use_travis(", 14 | "docker = ", docker_param, 15 | ")" 16 | ) 17 | ) 18 | 19 | shiny::stopApp() 20 | 21 | }) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /R/license_server.R: -------------------------------------------------------------------------------- 1 | license_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run_license, { 4 | 5 | license_function <- switch( 6 | input$license_selection, 7 | CC0 = "usethis::use_cc0_license", 8 | MIT = "usethis::use_mit_license", 9 | Apache_v2 = "usethis::use_apl2_license", 10 | GPL_v3 = "usethis::use_gpl3_license" 11 | ) 12 | 13 | rstudioapi::sendToConsole( 14 | paste0(paste(license_function), "(\"", paste(input$license_names), "\")") 15 | ) 16 | 17 | shiny::stopApp() 18 | 19 | }) 20 | 21 | } 22 | -------------------------------------------------------------------------------- /R/virtualisation_server.R: -------------------------------------------------------------------------------- 1 | virtualisation_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run, { 4 | 5 | rocker_param <- switch( 6 | input$rocker_selection, 7 | `rocker/rstudio` = "rstudio", 8 | `rocker/tidyverse` = "tidyverse", 9 | `rocker/verse` = "verse", 10 | `rocker/geospatial` = "geospatial" 11 | ) 12 | 13 | rstudioapi::sendToConsole( 14 | paste0( 15 | "rrtools::use_dockerfile(", 16 | "rocker = ", "\"", rocker_param, "\"", 17 | ")" 18 | ) 19 | ) 20 | 21 | shiny::stopApp() 22 | 23 | }) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [](https://travis-ci.org/nevrome/rrtools.addin) 4 | 5 | # rrtools.addin 6 | 7 | This package provides a graphical user interface for some of the main 8 | functions of [Ben Marwick’s rrtools 9 | package](https://github.com/benmarwick/rrtools). 10 | 11 |  13 | 14 | ## Installation 15 | 16 | ``` r 17 | # install.packages("devtools") 18 | devtools::install_github("benmarwick/rrtools") 19 | devtools::install_github("nevrome/rrtools.addin") 20 | ``` 21 | 22 | ## How to use 23 | 24 | ``` r 25 | rrtools.addin::rrtools_assistant() 26 | ``` 27 | -------------------------------------------------------------------------------- /man/rrtools_assistant.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rrtools_assistant.R 3 | \name{rrtools_assistant} 4 | \alias{rrtools_assistant} 5 | \title{rrtools RStudio Addin} 6 | \usage{ 7 | rrtools_assistant(startpanel = "Overview", run_app = TRUE) 8 | } 9 | \arguments{ 10 | \item{startpanel}{Character. Which page should be selected when the app is started? Default: "Overview".} 11 | 12 | \item{run_app}{Logical. Should the function start the app (TRUE) or return a shiny app object (FALSE)? Default: TRUE.} 13 | } 14 | \description{ 15 | This addin is a simplified interface to Ben Marwicks's rrtools package. 16 | For more documentation please check out the Addin itself and the rrtools 17 | README (\url{https://github.com/benmarwick/rrtools}). 18 | } 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: R 2 | cache: packages 3 | warnings_are_errors: true 4 | 5 | env: 6 | global: 7 | - secure: "C6k/yi2qpZ/75YJYHMQQ80ygC9EYaU0i4wJXoZaunNS+rRKaFulCOQrkmioWJ4eiSmNCO3BwN1KYoIFtEFMe72VvVgv5KPvSUl47HN5OhOITs7xw3eq2KSwiOsUo+C3NmcWzqn6Qtc7CDe1whGRA7XzkQ+J8HG8mFcbmookF/JxvSVpiJdrfzrEXbnCbHuyppAixA65eekW5QPFw135WwRjsAPjDQkZY3D7e6aM0ly0HpfGYyvnPCPlm3yqYSXo81qsaK0bGXJ6P7r438i1WaBHIdhDCYNYwcRL5iUVhm1siS45u/HYEgzrCo6mbWNsd+nJu8JcCjmhtDi4OghDidl65qRFrPS54WlQbW1iwwyKj3SL2Tlf+l9qiCEgp1/RMVACU+R7HQl+VBG+7vX8ScGDRNrImNwbv2Xy9MtPRXlnvW02luoB5j7tTa/zJv0Slryf8pWUkykgx6Hj205WOFIFPrR7u7zNMOQxKtdwfflKWG7cluM73hSm2gATh5AkTRiCH565EHqNU1YmJhWeJanNwapgQYBQBQebZlRm6je0q+CazyTs2hC0wVa28csaoSJF0bfVnmgvq2NhJmvOPnv6Mq8KX/W90VNkj6EIGisIMEE57sAFUlZbF1hNkdUp2uedPjIVySv97VcXSWmIajAVQCwbyU6OdanSXimYkwis=" 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # Example code in package build process 9 | *-Ex.R 10 | 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | 14 | # Output files from R CMD check 15 | /*.Rcheck/ 16 | 17 | # RStudio files 18 | .Rproj.user/ 19 | 20 | # produced vignettes 21 | vignettes/*.html 22 | vignettes/*.pdf 23 | 24 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 25 | .httr-oauth 26 | 27 | # knitr and R markdown default cache directories 28 | /*_cache/ 29 | /cache/ 30 | 31 | # Temporary files created by R markdown 32 | *.utf8.md 33 | *.knit.md 34 | 35 | # Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html 36 | rsconnect/ 37 | .Rproj.user 38 | 39 | # ignore app screenshots 40 | inst/gif/webshot* 41 | -------------------------------------------------------------------------------- /R/file_structure_server.R: -------------------------------------------------------------------------------- 1 | file_structure_server <- function(input, output, session) { 2 | 3 | shiny::observeEvent(input$run, { 4 | 5 | location_param <- switch( 6 | input$location_selection, 7 | `top-level directory` = "top_level", 8 | `inst/ directory` = "inst", 9 | `vignettes/ directory` = "vignettes" 10 | ) 11 | 12 | template_param <- switch( 13 | input$template_selection, 14 | paper.Rmd = "paper.Rmd" 15 | ) 16 | 17 | data_in_git_param <- switch( 18 | input$data_in_git_selection, 19 | Yes = TRUE, 20 | No = FALSE 21 | ) 22 | 23 | rstudioapi::sendToConsole( 24 | paste0( 25 | "rrtools::use_analysis(", 26 | "location = ", "\"", location_param, "\"", ", ", 27 | "template = ", "\"", template_param, "\"", ", ", 28 | "data_in_git = ", data_in_git_param, 29 | ")" 30 | ) 31 | ) 32 | 33 | shiny::stopApp() 34 | 35 | }) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /man/rrtools.addin-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rrtools.addin.R 3 | \docType{package} 4 | \name{rrtools.addin-package} 5 | \alias{rrtools.addin} 6 | \alias{rrtools.addin-package} 7 | \title{rrtools.addin: A graphical user interface for some of the main functions of the rrtools package} 8 | \description{ 9 | The rrtools package provides functions to create an R package research compendium - a powerful tool to create, manage and share reproducible research. rrtools.addin is a graphical interface to this package to make the start as easy as possible. It only provides one function to start the addin: rrtools_assistant(). 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://github.com/nevrome/rrtools.addin} 15 | \item Report bugs at \url{https://github.com/nevrome/rrtools.addin/issues} 16 | } 17 | 18 | } 19 | \author{ 20 | \strong{Maintainer}: Clemens Schmid \email{clemens@nevrome.de} 21 | 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: rrtools.addin 2 | Title: A graphical user interface for some of the main functions of the rrtools package 3 | Version: 0.2.2 4 | Authors@R: person("Clemens", "Schmid", email = "clemens@nevrome.de", role = c("aut", "cre")) 5 | Description: The rrtools package provides functions to create an R package research compendium - 6 | a powerful tool to create, manage and share reproducible research. 7 | rrtools.addin is a graphical interface to this package to make the start as easy as possible. 8 | It only provides one function to start the addin: rrtools_assistant(). 9 | Depends: R (>= 3.5.0) 10 | License: MIT + file LICENSE 11 | Encoding: UTF-8 12 | LazyData: true 13 | URL: https://github.com/nevrome/rrtools.addin 14 | BugReports: https://github.com/nevrome/rrtools.addin/issues 15 | Suggests: testthat 16 | RoxygenNote: 7.2.1 17 | Imports: 18 | bsplus, 19 | magrittr, 20 | miniUI, 21 | rrtools, 22 | rstudioapi, 23 | shiny, 24 | shinyFiles, 25 | tools, 26 | usethis 27 | Remotes: 28 | git@github.com:benmarwick/rrtools.git 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Clemens Schmid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | [](https://travis-ci.org/nevrome/rrtools.addin) 6 | 7 | # rrtools.addin 8 | 9 | This package provides a graphical user interface for some of the main functions of [Ben Marwick's rrtools package](https://github.com/benmarwick/rrtools). 10 | 11 | ```{r, echo = FALSE} 12 | # take screenshot of every panel 13 | panels <- c("Overview", "Setup", "License", "Readme", "File structure", "Virtualisation", "CI", "Tests") 14 | for (i in seq_along(panels)) { 15 | system( 16 | paste0("timeout 3 R -e \"shiny::runApp(rrtools.addin::rrtools_assistant(startpanel = '", panels[i], "', run_app = FALSE), port = 8081, launch.browser = FALSE)\""), 17 | wait = FALSE 18 | ) 19 | Sys.sleep(1) 20 | webshot::webshot(url = "http://127.0.0.1:8081/", file = paste0("inst/gif/webshot_", 100 + i, "_", ".png"), vwidth = 1200, vheight = 500) 21 | Sys.sleep(1) 22 | } 23 | # make gif from individual screenshots 24 | system("convert -delay 150 -loop 0 inst/gif/*.png inst/gif/rrtools_addin_demo.gif") 25 | ``` 26 | 27 |  28 | 29 | ## Installation 30 | 31 | ```{r, eval=FALSE} 32 | # install.packages("devtools") 33 | devtools::install_github("benmarwick/rrtools") 34 | devtools::install_github("nevrome/rrtools.addin") 35 | ``` 36 | 37 | ## How to use 38 | 39 | ```{r, eval=FALSE} 40 | rrtools.addin::rrtools_assistant() 41 | ``` 42 | -------------------------------------------------------------------------------- /R/setup_server.R: -------------------------------------------------------------------------------- 1 | setup_server <- function(input, output, session) { 2 | 3 | osSystem <- Sys.info()["sysname"] 4 | if (osSystem == "Linux") { 5 | def_roots <- c(home = "~") 6 | } else { 7 | def_roots <- shinyFiles::getVolumes()() 8 | } 9 | 10 | shinyFiles::shinyDirChoose(input, 'use_compendium_path', roots = def_roots) 11 | 12 | use_compendium_path_ready <- shiny::reactive({ 13 | if(length(input$use_compendium_path) == 1) { 14 | path <- "not yet definded" 15 | } else { 16 | path <- file.path( 17 | shinyFiles::parseDirPath(def_roots, input$use_compendium_path) 18 | ) 19 | } 20 | return(path) 21 | }) 22 | 23 | output$use_compendium_path_ready <- shiny::renderUI({ 24 | shiny::HTML("", use_compendium_path_ready(), "") 25 | }) 26 | 27 | shiny::observeEvent(input$run_use_compendium, { 28 | if (use_compendium_path_ready() != "not yet definded") { 29 | # prepare decisions 30 | rstudio_param <- switch( 31 | input$rstudio_selection, 32 | Yes = TRUE, 33 | No = FALSE 34 | ) 35 | open_param <- switch( 36 | input$open_selection, 37 | Yes = TRUE, 38 | No = FALSE 39 | ) 40 | # run use_compendium and close app 41 | rstudioapi::sendToConsole( 42 | paste0( 43 | "rrtools::use_compendium(", 44 | "path = \"", use_compendium_path_ready(), "\",", 45 | "rstudio = ", rstudio_param, ",", 46 | "open = ", open_param, 47 | ")" 48 | ) 49 | ) 50 | shiny::stopApp() 51 | } else { 52 | shiny::showNotification("Path not defined.") 53 | } 54 | }) 55 | 56 | } 57 | -------------------------------------------------------------------------------- /inst/style/rrtools_assistant_stylesheet.css: -------------------------------------------------------------------------------- 1 | /* general layout */ 2 | .h2, h2 { 3 | font-size: 20px; 4 | } 5 | /* file browser */ 6 | .sF-breadcrumps { 7 | width: calc(90% - 255px) !important; 8 | } 9 | .modal-content { 10 | width: 700px; 11 | } 12 | .modal-body { 13 | height: 330px; 14 | overflow-y: scroll; 15 | } 16 | /* boxes */ 17 | .explainbox_1 { 18 | position: relative; 19 | height: 170px; 20 | background: #b2ff91; 21 | border-radius: 15px; 22 | padding: 15px; 23 | padding-top: 5px; 24 | margin-top: 10px; 25 | margin-right: 10px; 26 | margin-left: 10px; 27 | } 28 | .explainbox_2 { 29 | position: relative; 30 | height: 170px; 31 | background: #b7daff; 32 | border-radius: 15px; 33 | padding: 15px; 34 | padding-top: 5px; 35 | margin-right: 10px; 36 | margin-left: 10px; 37 | } 38 | .function_interface_outer { 39 | overflow-y: hidden; 40 | height: 360px; 41 | position: relative; 42 | margin-top: 10px; 43 | border-radius: 15px; 44 | border-style: solid; 45 | border-width: 5px; 46 | border-color: red; 47 | padding: 10px; 48 | padding-top: 5px; 49 | } 50 | .function_interface_inner { 51 | overflow-y: auto; 52 | height: 330px; 53 | position: relative; 54 | overflow-y: auto; 55 | } 56 | .overviewpagebox { 57 | overflow-y: auto; 58 | height: 360px; 59 | position: relative; 60 | background: #f2f2f2; 61 | border-radius: 15px; 62 | padding: 15px; 63 | margin-top: 10px; 64 | margin-right: 10px; 65 | margin-left: 10px; 66 | } 67 | .helpbox { 68 | overflow-y: auto; 69 | height: 360px; 70 | position: relative; 71 | background: #f2f2f2; 72 | border-radius: 15px; 73 | padding: 15px; 74 | padding-top: 5px; 75 | margin-top: 10px; 76 | margin-right: 10px; 77 | margin-left: 10px; 78 | color: #999999; 79 | } 80 | .imagebox { 81 | height: 360px; 82 | position: relative; 83 | margin-top: 10px; 84 | margin-right: 10px; 85 | margin-left: 10px; 86 | } 87 | -------------------------------------------------------------------------------- /R/tests_ui.R: -------------------------------------------------------------------------------- 1 | tests_ui <- function(id) { 2 | 3 | ns <- shiny::NS(id) 4 | 5 | miniUI::miniTabPanel( 6 | title = "Tests", 7 | icon = shiny::icon("bolt"), 8 | shiny::fillRow( 9 | flex = c(1, 1, 1), 10 | shiny::fillCol( 11 | shiny::div( 12 | class = "explainbox_1", 13 | shiny::h4("Software tests?"), 14 | shiny::HTML("
15 | If the code in a compendium gets more complex, 16 | it becomes more difficult to estimate the consequences of changes. 17 | Therefore code should be modular and automatically tested. 18 | In an R package 19 | testing 20 | can be managed with the 21 | testthat 22 | package. 23 |
") 24 | ), 25 | shiny::div( 26 | class = "explainbox_2", 27 | shiny::h4("The function", shiny::strong("usethis::use_testthat")), 28 | shiny::HTML(" 29 |15 | Especially if you share your work on cloud version control platforms 16 | like Github the README file is the 17 | face of your project 18 | for everybody who comes across it. It's important to give a good 19 | overview about what the project does and how users can get started with it. 20 |
") 21 | ), 22 | shiny::div( 23 | class = "explainbox_2", 24 | shiny::h4("The function", shiny::strong("rrtools::use_readme_rmd")), 25 | shiny::HTML(" 26 |15 | CI is a concept of software development that 16 | comprises powerful ideas like the automation of building, 17 | testing and deploying. 18 | For a compendium with complex code this can be useful, 19 | but also other projects can profit from automatic text rendering 20 | on platforms like 21 | Travis CI. 22 |
") 23 | ), 24 | shiny::div( 25 | class = "explainbox_2", 26 | shiny::h4("The function", shiny::strong("usethis::use_travis")), 27 | shiny::HTML(" 28 |
71 | rrtools offers a similar function for Circle CI: rrtools::use_circleci().
72 | Check it out if Travis CI does not fit your needs.
73 |
15 | Software is constantly changing. Often old code does 16 | not run or old data can't be retrieved anymore. 17 | Data analysis scripts in R are especially vulnerable to this. 18 | Virtualisation software like 19 | Docker 20 | can store a compendium in a digital time capsule to keep it alive. 21 |
") 22 | ), 23 | shiny::div( 24 | class = "explainbox_2", 25 | shiny::h4("The function", shiny::strong("rrtools::use_dockerfile")), 26 | shiny::HTML(" 27 |15 | A research compendium usually contains code and data. If you provide your intellectual property 16 | in an open and reproducible form, you have to assume that others will use it for their purposes. 17 | To codify what kind of things they are allowed to do you need a 18 | project license. 19 |
") 20 | ), 21 | shiny::div( 22 | class = "explainbox_2", 23 | shiny::h4("The function", shiny::strong("usethis::use_..._license")), 24 | shiny::HTML(" 25 |This RStudio Addin is a graphical interface to Ben Marwick's 46 | rrtools package. 47 | rrtools provides instructions, templates, and functions for making a basic compendium 48 | suitable for writing reproducible research with R.
49 | "), 50 | shiny::HTML(" 51 |The approach is based generally on 52 | Kitzes et al. (2017), 53 | and more specifically on 54 | Marwick (2017), 55 | Marwick et al. (2017), and 56 | Wickham's (2017) 57 | work using the R package structure as the basis for a research compendium.
58 | "), 59 | shiny::HTML(" 60 |This Addin allows to access some, but not all of the functionality in the rrtools package. 61 | Please see the rrtools README for more detailed information.
62 | ") 63 | ) 64 | ), 65 | shiny::fillCol( 66 | shiny::div( 67 | class = "imagebox", 68 | shiny::img( 69 | src = "/image/overview.png", 70 | align = "center" 71 | ) 72 | ) 73 | ) 74 | ) 75 | ), 76 | # submodules 77 | setup_ui("setup_general"), 78 | license_ui("license_general"), 79 | readme_ui("readme_general"), 80 | file_structure_ui("file_structure_general"), 81 | virtualisation_ui("virtualisation_general"), 82 | #ci_cd_ui("ci_cd_general"), 83 | tests_ui("tests_general"), 84 | # options for miniTabstripPanel 85 | selected = startpanel 86 | ) 87 | ) 88 | } 89 | 90 | #### server #### 91 | server <- function(input, output, session) { 92 | 93 | # submodules 94 | shiny::callModule(license_server, id = "license_general") 95 | shiny::callModule(setup_server, id = "setup_general") 96 | shiny::callModule(readme_server, id = "readme_general") 97 | shiny::callModule(file_structure_server, id = "file_structure_general") 98 | shiny::callModule(virtualisation_server, id = "virtualisation_general") 99 | shiny::callModule(ci_cd_server, id = "ci_cd_general") 100 | shiny::callModule(tests_server, id = "tests_general") 101 | 102 | # help button 103 | shiny::observeEvent(input$help_button, { 104 | utils::browseURL("https://github.com/nevrome/rrtools.addin/issues") 105 | }) 106 | 107 | # cancel button 108 | shiny::observeEvent(input$cancel, { 109 | shiny::stopApp() 110 | }) 111 | 112 | } 113 | 114 | app_object <- shiny::shinyApp(ui, server) 115 | 116 | #### run app #### 117 | if (run_app) { 118 | shiny::runGadget( 119 | app_object, 120 | viewer = shiny::dialogViewer("rrtools", width = 1200, height = 500), 121 | stopOnCancel = FALSE 122 | ) 123 | } else { 124 | return(app_object) 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /R/file_structure_ui.R: -------------------------------------------------------------------------------- 1 | file_structure_ui <- function(id) { 2 | 3 | ns <- shiny::NS(id) 4 | 5 | miniUI::miniTabPanel( 6 | title = "File structure", 7 | icon = shiny::icon("folder"), 8 | shiny::fillRow( 9 | flex = c(1, 1, 1), 10 | shiny::fillCol( 11 | shiny::div( 12 | class = "explainbox_1", 13 | shiny::h4("Writing a paper in R?"), 14 | shiny::HTML("15 | The most important part of a research compendium is the actual analysis document. 16 | There are powerful tools for text production in R and the 17 | bookdown framework 18 | combines them to provide a writing environment, 19 | that still can produce output in PDF, HTML and even Word. 20 |
") 21 | ), 22 | shiny::div( 23 | class = "explainbox_2", 24 | shiny::h4("The function", shiny::strong("rrtools::use_analysis")), 25 | shiny::HTML(" 26 |15 | Each reproducible research project lives in an own directory on your computer. 16 | This directory needs some special files and subfolders to work as an 17 | R package. 18 | The first step in the creation of a research compendium is to create and 19 | configure all of this. 20 |
") 21 | ), 22 | shiny::div( 23 | class = "explainbox_2", 24 | shiny::h4("The function", shiny::strong("rrtools::use_compendium")), 25 | shiny::HTML(" 26 |42 | Usually we want our research compendium to be managed by the version control software 43 | Git. 44 | Start on Github, Gitlab, or a similar web service, and 45 | create an empty repository 46 | called pkgname (you should use a different name, please follow the rules below) on that service. 47 | Then clone that repository to have a local empty directory on your computer, called pkgname, 48 | that is linked to this remote repository. 49 |
50 |51 | The name of your project has to be a good representation 52 | of its content and also has to fulfil some technical 53 | requirements. See 54 | Hadley Wickhams helpful hints 55 | for advice. Jim Hesters R package 56 | available 57 | makes it easy to check if your name is already in use 58 | somewhere or if it has some unintended meanings. 59 |
" 60 | ), 61 | shiny::strong("Select the directory:"), 62 | shinyFiles::shinyDirButton( 63 | id = ns("use_compendium_path"), 64 | label = "Choose directory", 65 | title = "Directory selection", 66 | icon = shiny::icon("folder") 67 | ), 68 | shiny::br(), 69 | shiny::strong("The new project will be created here:"), 70 | shiny::htmlOutput(ns("use_compendium_path_ready")), 71 | shiny::selectInput( 72 | inputId = ns("rstudio_selection"), 73 | label = "Should an RStudio Project file be created?", 74 | choices = c("Yes", "No"), 75 | selected = "Yes", 76 | width = "95%" 77 | ) %>% 78 | bsplus::shinyInput_label_embed( 79 | bsplus::shiny_iconlink("circle-info") %>% 80 | bsplus::bs_embed_popover( 81 | title = "What's an RStudio Project?", 82 | content = " 83 | If you work in RStudio, then the 84 | RStudio Project 85 | infrastructure is the best and most natural way of 86 | organizing your work. The project file is a text file 87 | that contains some configuration values for your project. 88 | You don't have to edit it directly, because RStudio 89 | automatically changes it according to your settings in 90 | the RStudio menus. 91 | ", 92 | placement = "left", 93 | html = "true" 94 | ) 95 | ), 96 | shiny::selectInput( 97 | inputId = ns("open_selection"), 98 | label = "Should a new RStudio Session be started?", 99 | choices = c("Yes", "No"), 100 | selected = "Yes", 101 | width = "95%" 102 | ) %>% 103 | bsplus::shinyInput_label_embed( 104 | bsplus::shiny_iconlink("circle-info") %>% 105 | bsplus::bs_embed_popover( 106 | title = "What's going to happen?", 107 | content = " 108 | If you choose Yes, then a new RStudio window will open 109 | and you can directly start to work in your new project. 110 | ", 111 | placement = "left", 112 | html = "true" 113 | ) 114 | ), 115 | shiny::actionButton( 116 | inputId = ns("run_use_compendium"), 117 | label = "Create new project", 118 | icon = shiny::icon("circle-arrow-right"), 119 | width = "95%" 120 | ) 121 | ) 122 | ) 123 | ), 124 | shiny::fillCol( 125 | shiny::div( 126 | class = "helpbox", 127 | shiny::HTML(extract_help_as_html("rrtools", "use_compendium")) 128 | ) 129 | ) 130 | ) 131 | ) 132 | 133 | } 134 | -------------------------------------------------------------------------------- /inst/image/overview.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 174 | --------------------------------------------------------------------------------