Skip to content

Commit

Permalink
Build site
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 1, 2024
1 parent f6fc96f commit 90bebb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ <h1>Events and Resources</h1>
<hr>
<div id="upcoming-nmfs-r-ug-events" class="section level2">
<h2>Upcoming NMFS R UG Events</h2>
<p>Seeing a blank calendar? You must be logged into your NOAA email. We have events every week.</p>
<iframe src="https://calendar.google.com/calendar/embed?height=600&amp;wkst=1&amp;ctz=America%2FLos_Angeles&amp;bgcolor=%23ffffff&amp;src=Y185MTZiNjk0OGVmMmVlOGI3ZDQ5YzI4NjYxZWZjMDc5ODMwM2MyNzQyYmUzOTljOTI5MGZhMDJkOTMyMGM3NjllQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20&amp;src=bm9hYS5nb3ZfNjByZm43bWw5cnBjaGw2M3ZzNGFmOW4wMThAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&amp;color=%23F4511E&amp;color=%23A79B8E" style="border:solid 1px #777" width="800" height="600" frameborder="0" scrolling="no">
</iframe>
<!--
Expand Down Expand Up @@ -1056,6 +1057,7 @@ <h1>Events and Resources</h1>
<hr>
<div id="upcoming-nmfs-r-ug-events" class="section level2">
<h2>Upcoming NMFS R UG Events</h2>
<p>Seeing a blank calendar? You must be logged into your NOAA email. We have events every week.</p>
<iframe src="https://calendar.google.com/calendar/embed?height=600&amp;wkst=1&amp;ctz=America%2FLos_Angeles&amp;bgcolor=%23ffffff&amp;src=Y185MTZiNjk0OGVmMmVlOGI3ZDQ5YzI4NjYxZWZjMDc5ODMwM2MyNzQyYmUzOTljOTI5MGZhMDJkOTMyMGM3NjllQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20&amp;src=bm9hYS5nb3ZfNjByZm43bWw5cnBjaGw2M3ZzNGFmOW4wMThAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&amp;color=%23F4511E&amp;color=%23A79B8E" style="border:solid 1px #777" width="800" height="600" frameborder="0" scrolling="no">
</iframe>
<!--
Expand Down
4 changes: 2 additions & 2 deletions docs/posts/posts.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"contents": "\nThis is for vdiffr version 1.0.2.9000. The package is in development so syntax and behavior is likely to change. Read the testing chapter in the R packages book for background on writing tests for R packages.\nTests to compare two images\nhttps://vdiffr.r-lib.org/ is a package that integrates with the testthat package to allow tests that compare plot outputs.\nSetting up your package for unit testing\nusethis::use_testthat()\nMakes the tests folder and testthat subfolder.\nWithin the testthat folder,\nusethis::use_test(name=\"xyz\")\nThis will make a test file test-xyz.R in the testthis subfolder. When you make your own test files, replace “xyz” with your test name.\nTo run the tests, you can open test-xyz.R in RStudio and it will recognize that this is a test file. “Run tests” will show up on the upper right of the file.\nsnapshot workflow\nThe first time that you run expect_doppelganger(\"xyz\", plt1) within a test_that() call, a snapshot expectation will run and a svg of plt1 will be made in tests/testthat/_snaps/xyz called xyz.svg. The next time expect_doppelganger(\"xyz\", plt2) is run within a test_that() call, a svg of plt2 will be made and compared to xyz.svg. If it is different, the file xyz.new.svg will be made in tests/testthat/_snaps/xyz.\nBecause of this workflow, we want to make sure tests/testthat/_snaps/xyz is empty before we start because we have to run expect_doppelganger(\"xyz\", plt1) to create xyz.svg but if xyz.svg is already there from previous tests, we might end up creating xyz.new.svg if plt1 is a different plot than xyz.svg.\nThe full test-xyz.R test file is below. Here I break down the parts of that file.\nHeader\nGive some info about the tests (context), load packages, and then clean up the _snaps folder. Having old svgs there can mess up your tests.\ncontext(\"xyz\")\nlibrary(ggplot2)\nlibrary(vdiffr)\n\n# Clean up the _snaps folder for this test file\n# Note this won't be necessary in some situations\nfils <- dir(file.path(here::here(), \"tests\", \"testthat\", \"_snaps\", \"xyz\"), full.names = TRUE)\nfile.remove(fils)\nCompare two ggplots plot\nHere is the contents of test-xyz.R to compare two plots. This test should fail because the plots are different.\nStep 1 make first plot and run expect_doppelganger() to create a svg file in _snaps that is used to compare against. The name of the file is the first argument and must be the same in the expect_doppelganger() calls.\nplt <- ggplot(mtcars, aes(mpg)) + geom_histogram()\n# Save as ggplot-test1.svg in _snaps folder\n# This will appear as a successful test, i.e. plot successfully created\ntest_that(\"setup\", {\n expect_doppelganger(\"ggplot-test1\", plt)\n})\nStep 2. Create 2nd plot and compare to ggplot-test1.svg already in _snaps folder.\nplt <- ggplot(mtcars, aes(disp)) + geom_histogram()\ntest_that(\"plots are different\", {\n expect_doppelganger(\"ggplot-test1\", plt)\n})\nSince they are different, you will see ggplot-test1.new.svg in the _snaps folder.\nCompare two base plots\nThe syntax here is a little different. The object that you pass into expect_doppelganger() as the second argument is a function that creates the base plot. Otherwise the steps are the same.\nplt <- function(){ hist(mtcars$mpg) }\n# Step 1. Create base-test.svg\n# This will appear as a successful test, i.e. plot successfully created\ntest_that(\"setup\", {\n expect_doppelganger(\"base-test\", plt)\n})\n# Step 2. Test new plot against base-test.svg\n# Test will fail since they are different\nplt <- function(){ hist(mtcars$disp) }\ntest_that(\"plots are different\", {\n expect_doppelganger(\"base-test\", plt)\n})\nFinal test-xyz.R file\nThis should be in the testthat folder in tests folder. Running this will show 2 Fails and 4 Passes. To run, you can open the file in RStudio and look for the “Run Tests” button in top right of file. Or run this code.\nfil <- file.path(here::here(), \"tests\", \"testthat\", \"test-xyz.R\")\ntestthat::test_file(fil)\nOr open the file in RStudio and run this code:\ndevtools::test_active_file()\nThe full test file.\ncontext(\"xyz\")\nlibrary(ggplot2)\nlibrary(vdiffr)\n\n# Clean up the _snaps folder for this test file\n# Note this won't be necessary in some situations\nfils <- dir(file.path(here::here(), \"tests\", \"testthat\", \"_snaps\", \"xyz\"), full.names = TRUE)\nfile.remove(fils)\n\n# This test should fail. The plots are different\n# Step 1 make first plot\nplt <- ggplot(mtcars, aes(mpg)) + geom_histogram()\n# Save as ggplot-test1.svg in _snaps folder\n# This will appear as a successful test, i.e. plot successfully created\ntest_that(\"setup\", {\n expect_doppelganger(\"ggplot-test1\", plt)\n})\n# Step 2. Create 2nd plot and compare to ggplot-test1.svg in _snaps folder\nplt <- ggplot(mtcars, aes(disp)) + geom_histogram()\ntest_that(\"plots are different\", {\n expect_doppelganger(\"ggplot-test1\", plt)\n})\n# Since they are different, you will see ggplot-test1.new.svg in the _snaps folder\n\n# This test should not fail. The plots should be the same.\nfun <- function(dat){ return(ggplot(dat, aes(mpg)) + geom_histogram()) }\nplt <- fun(mtcars)\n# Step 1. Create ggplot-test2.svg\n# This will appear as a successful test, i.e. plot successfully created\ntest_that(\"setup\", {\n expect_doppelganger(\"ggplot-test2\", plt)\n})\n# Step 2. Test new plot against ggplot-test2.svg\nplt <- fun(na.omit(mtcars))\ntest_that(\"plots are the same\", {\n expect_doppelganger(\"ggplot-test2\", plt)\n})\n# Since they are the same, you will NOT see ggplot-test2.new.svg in the _snaps folder\n\n# Comparing plots made with base graphics; Create a function that makes the plot\nplt <- function(){ hist(mtcars$mpg) }\n# Step 1. Create base-test.svg\n# This will appear as a successful test, i.e. plot successfully created\ntest_that(\"setup\", {\n expect_doppelganger(\"base-test\", plt)\n})\n# Step 2. Test new plot against base-test.svg\n# Test will fail since they are different\nplt <- function(){ hist(mtcars$disp) }\ntest_that(\"plots are different\", {\n expect_doppelganger(\"base-test\", plt)\n})\n\n\n\n",
"preview": {},
"last_modified": "2024-05-01T20:06:43+00:00",
"last_modified": "2024-05-01T20:25:07+00:00",
"input_file": {}
},
{
Expand All @@ -33,7 +33,7 @@
"categories": [],
"contents": "\nThe R-Govys blog is a place for R-Govys users to post write-ups on topics of interest to the group. Suggestions:\nExample of using R in your work\nExample of a new R feature or package\nDiscussion of changes in how R is used in government\nWrite-up of a meeting review or summary\n\n\n\n",
"preview": {},
"last_modified": "2024-05-01T20:06:43+00:00",
"last_modified": "2024-05-01T20:25:07+00:00",
"input_file": {}
}
]
14 changes: 7 additions & 7 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" version="1.0">
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/Meetings.html</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/posts.html</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/resources.html</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/workshops.html</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/posts/2021-09-28-vdiffr/</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
<url>
<loc>https://nmfs-opensci.github.io/NMFS-R-UG/posts/2021-09-15-welcome/</loc>
<lastmod>2024-05-01T20:06:43+00:00</lastmod>
<lastmod>2024-05-01T20:25:07+00:00</lastmod>
</url>
</urlset>

0 comments on commit 90bebb7

Please sign in to comment.