Open tiozab opened 9 months ago
I believe you are looking for this function: makeReport()
.
Example:
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "IncidencePrevalence")
# Clone repo
git2r::clone(
url = "https://github.com/darwin-eu/IncidencePrevalence.git",
local_path = pathToRepo
)
# Create instance of Repository object.
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = tempfile())
Thanks @mvankessel-EMC, I also found this article: https://github.com/darwin-eu-dev/PaRe/blob/HEAD/vignettes/articles/PareReport.Rmd
but having the function makeReport is much more easy! Thanks. One question though: how to look at the outputFile in a nice and structured way? Right now I only see lots of files in a folder.
You can specify the outputPath
to a file location yourself. If you set it to "pareReport.html", it will write the html-file into your current getwd()
.
Also when using the code in my earlier response, it should also report the path where the file is written to in the console.
@mvankessel-EMC I do not understand. Using your code, how can I get the report in html format?
repo <- PaRe::Repository$new(path = "C:\Users\tburkard\OneDrive - Nexus365\Documents\GitHub\PETDiagnostics") makeReport(repo = repo, ... ) ?
repo <- PaRe::Repository$new(path = "C:\Users\tburkard\OneDrive - Nexus365\Documents\GitHub\PETDiagnostics")
makeReport(repo = repo, "pareReport.html")
An example with messages:
library(PaRe)
# You don't need to do this
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "IncidencePrevalence")
# You don't need to do this
git2r::clone(
url = "https://github.com/darwin-eu/IncidencePrevalence.git",
local_path = pathToRepo
)
#> cloning into 'C:\Users\MVANKE~1\AppData\Local\Temp\RtmpQDUU35/IncidencePrevalence'...
#> Receiving objects: 1% (14/1346), 63 kb
#> Receiving objects: 11% (149/1346), 295 kb
#> Receiving objects: 21% (283/1346), 1080 kb
#> Receiving objects: 31% (418/1346), 1136 kb
#> Receiving objects: 41% (552/1346), 2088 kb
#> Receiving objects: 51% (687/1346), 2873 kb
#> Receiving objects: 61% (822/1346), 2929 kb
#> Receiving objects: 71% (956/1346), 6155 kb
#> Receiving objects: 81% (1091/1346), 7500 kb
#> Receiving objects: 91% (1225/1346), 8788 kb
#> Receiving objects: 100% (1346/1346), 10185 kb, done.
#> Local: main C:/Users/mvankessel/AppData/Local/Temp/RtmpQDUU35/IncidencePrevalence
#> Remote: main @ origin (https://github.com/darwin-eu/IncidencePrevalence.git)
#> Head: [a4969b8] 2023-12-11: v0.6
# Create instance of Repository object.
# pathToRepo: the path where your package is located
repo <- PaRe::Repository$new(path = pathToRepo)
# repo: repo object you just created
# outputFIle: file name, with our without path
makeReport(repo = repo, outputFile = "pareReport.html")
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
#> Linking to ImageMagick 6.9.12.93
#> Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fontconfig, x11
#> processing file: report.Rmd
#> output file: report.knit.md
#> "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS report.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc35c87fa21e94.html --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template "C:\R\R-4.3.1\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=cosmo --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\MVANKE~1\AppData\Local\Temp\RtmpQDUU35\rmarkdown-str35c8a163b11.html"
#>
#> Output created: C:\Users\mvankessel\AppData\Local\Temp\Rtmp8ayrH6\reprex-39241f3624c8-front-ray\pareReport.html
Created on 2024-01-08 with reprex v2.0.2
As you can see it points you directly at the path where the report is located.
Thank you, the html report is empty, likely because he dependency review throughs an error (in the console)
label: checkDependencies (with options) List of 2 $ echo : logi FALSE $ warning: logi FALSE
Quitting from lines 164-165 (report.Rmd) |.................................................................................................. | 81% inline R code fragments
|...................................................................................................... | 84% label: dependencyGraphStats (with options) List of 3 $ echo : logi FALSE $ message: logi FALSE $ warning: logi FALSE
Quitting from lines 173-182 (report.Rmd) Error in pak::pkg_deps(deps) : length(pkg) == 1 && is.character(pkg) is not TRUE
Also when I run it individually from the vignette: DT::datatable(PaRe::checkDependencies(repo = repo, verbose = FALSE)) length(pkg) == 1 && is.character(pkg) is not TRUEThe following are not permitted: CDMConnector, checkmate, DBI, dplyr, duckdb, glue, lubridate, magrittr, misty, rlang, here, tidyr, stats, tibble, zip Please open an issue here: https://github.com/mvankessel-EMC/DependencyReviewerWhitelists/issues
I'm not entirely sure what is going on here. Here is an example with the PETDiagnostics repo they you are using:
library(PaRe)
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "PETDiagnostics")
# Clone repo
git2r::clone(
url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git",
local_path = pathToRepo
)
#> cloning into 'C:\Users\MVANKE~1\AppData\Local\Temp\RtmpkFilLd/PETDiagnostics'...
#> Receiving objects: 1% (5/481), 63 kb
#> Receiving objects: 11% (53/481), 1023 kb
#> Receiving objects: 21% (102/481), 1023 kb
#> Receiving objects: 31% (150/481), 1023 kb
#> Receiving objects: 41% (198/481), 1023 kb
#> Receiving objects: 51% (246/481), 1023 kb
#> Receiving objects: 61% (294/481), 1079 kb
#> Receiving objects: 71% (342/481), 1079 kb
#> Receiving objects: 81% (390/481), 1079 kb
#> Receiving objects: 91% (438/481), 1079 kb
#> Receiving objects: 100% (481/481), 1082 kb, done.
#> Local: main C:/Users/mvankessel/AppData/Local/Temp/RtmpkFilLd/PETDiagnostics
#> Remote: main @ origin (https://github.com/oxford-pharmacoepi/PETDiagnostics.git)
#> Head: [8c42bea] 2023-12-29: update CDMConnector
# Create instance of Repository object.
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
#> Linking to ImageMagick 6.9.12.93
#> Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fontconfig, x11
#> processing file: report.Rmd
#> output file: report.knit.md
#> "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS report.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc35c431194755.html --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template "C:\R\R-4.3.1\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=cosmo --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\MVANKE~1\AppData\Local\Temp\RtmpkFilLd\rmarkdown-str35c468e06dd5.html"
#>
#> Output created: C:\Users\mvankessel\AppData\Local\Temp\Rtmp8ayrH6\reprex-39241186a64-cushy-kitty\pareReport.html
Created on 2024-01-08 with reprex v2.0.2
which seems to work flawless to me.
PaRe
?@mvankessel-EMC I just tried your code, yes, I am using version 0.1.12 (same as on CRAN) here is the reprex: library(PaRe)
tempDir <- tempdir() pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone( url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git", local_path = pathToRepo )
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
Created on 2024-01-08 with reprex v2.0.2
What version of R are you using?
[1] "R version 4.2.1 (2022-06-23 ucrt)" should I update to 4.2.3?
[1] "R version 4.2.1 (2022-06-23 ucrt)" should I update to 4.2.3?
I would try that and see if that helps.
@mvankessel-EMC I updated to [1] "R version 4.3.2 (2023-10-31 ucrt)" but the error prevails, here is the reprex
library(PaRe)
tempDir <- tempdir() pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone( url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git", local_path = pathToRepo )
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
pak::pkg_deps()
:Created on 2024-01-10 with reprex v2.0.2
CodelistGenerator
was kicked off CRAN. PaRe
was trying to look for it there, but didn't exist. I've changed it so it looks at the version on GitHub. Could you try running it again?
since the version number of PaRe has not changed, you are suggesting that I use the developer version of PaRe from this repo and try again?
No, I updated the whitelist that PaRe
looks at, which is separate from PaRe itself. Because it now look at the CodelistGenerator package from the darwin-eu repository, instead of the CRAN version (which does not exist anymore), I think your problem should be resolved if you try running your code again.
library(PaRe)
tempDir <- tempdir() pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone( url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git", local_path = pathToRepo )
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
pak::pkg_deps()
:Created on 2024-01-26 with reprex v2.0.2
It works for me. Could you provide me with a reprex, listing all the loaded packages, with the following script?
library(PaRe)
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone(
url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git",
local_path = pathToRepo
)
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
Select Addins -> Search reprex
-> select Render reprex...
If you do not find anything when seraching reprex
, you can install it with: install.packages("reprex")
, and restart Rstudio.
Set the following options, and click Render
You don't need to copy anything, you just need to paste it in a comment here. It will look like this:
library(PaRe)
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone(
url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git",
local_path = pathToRepo
)
#> cloning into 'C:\Users\MVANKE~1\AppData\Local\Temp\RtmpOqZMoe/PETDiagnostics'...
#> Receiving objects: 1% (5/481), 63 kb
#> Receiving objects: 11% (53/481), 1023 kb
#> Receiving objects: 21% (102/481), 1023 kb
#> Receiving objects: 31% (150/481), 1023 kb
#> Receiving objects: 41% (198/481), 1023 kb
#> Receiving objects: 51% (246/481), 1023 kb
#> Receiving objects: 61% (294/481), 1079 kb
#> Receiving objects: 71% (342/481), 1079 kb
#> Receiving objects: 81% (390/481), 1079 kb
#> Receiving objects: 91% (438/481), 1079 kb
#> Receiving objects: 100% (481/481), 1082 kb, done.
#> Local: main C:/Users/mvankessel/AppData/Local/Temp/RtmpOqZMoe/PETDiagnostics
#> Remote: main @ origin (https://github.com/oxford-pharmacoepi/PETDiagnostics.git)
#> Head: [8c42bea] 2023-12-29: update CDMConnector
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
#> Linking to ImageMagick 6.9.12.93
#> Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fontconfig, x11
#> Warning: package 'knitr' was built under R version 4.3.2
#> processing file: report.Rmd
#> output file: report.knit.md
#> "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS report.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc8884226a814.html --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template "C:\R\R-4.3.1\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=cosmo --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\MVANKE~1\AppData\Local\Temp\RtmpOqZMoe\rmarkdown-str888457ff2981.html"
#>
#> Output created: C:\Users\mvankessel\AppData\Local\Temp\RtmpUPd1VK\reprex-35f0e7376f3-hexed-tuna\pareReport.html
Created on 2024-02-02 with reprex v2.0.2
library(PaRe) library(sessioninfo)
tempDir <- tempdir() pathToRepo <- file.path(tempDir, "PETDiagnostics")
git2r::clone( url = "https://github.com/oxford-pharmacoepi/PETDiagnostics.git", local_path = pathToRepo )
repo <- PaRe::Repository$new(path = pathToRepo)
makeReport(repo = repo, outputFile = "pareReport.html")
pak::pkg_deps()
:sessioninfo::session_info()
Created on 2024-02-02 with reprex v2.0.2
Session info sessioninfo::session_info()
I use reprex I dont know why it does not depict as nicely as yours, I just copy paste what is in the reprex
I use reprex I dont know why it does not depict as nicely as yours, I just copy paste what is in the reprex
Reprex automatically puts the formatted output on the clipboard, so you don't need to copy anything, just paste it. But thank you!
Could you try installing pak
version 0.5.1?
remotes::install_version(package = "pak", version = "0.5.1")
And then try again?
It seems like they changed something with a function I'm using.
I am not sure how to perform a PaRe report. the article just shows the output, but not the code https://darwin-eu-dev.github.io/PaRe/articles/PareReport.html