diff --git a/data-raw/noaa-data.R b/data-raw/noaa-data.R index 8de1b90..649d9f9 100644 --- a/data-raw/noaa-data.R +++ b/data-raw/noaa-data.R @@ -1,15 +1,11 @@ ## code to prepare `NOAA_data` dataset + library(tibble) NOAA_data <- tibble( variable = c("temperature", "phosphate", "nitrate", "silicate", "oxygen", "salinity", "density"), - unit = c( - "\u00b0 C", - rep("\u03bc mol kg-1", 4), - "", - "kg m-3" - ), + unit = c("C", rep("micromol kg-1", 4), "", "kg m-3"), citation = c( vc_cite["temperature"], rep(vc_cite["nutrients"], 3), @@ -19,4 +15,5 @@ NOAA_data <- tibble( ) ) +#save(NOAA_data, file = "data/NOAA_data.rda", ascii = TRUE, version = 3) usethis::use_data(NOAA_data, overwrite = TRUE) diff --git a/data/NOAA_data.rda b/data/NOAA_data.rda index 0c2b91b..18f2e88 100644 Binary files a/data/NOAA_data.rda and b/data/NOAA_data.rda differ diff --git a/inst/WORDLIST b/inst/WORDLIST index a934952..f37c1bd 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -99,9 +99,7 @@ https io isbn knitr -ncei nd -noaa pkgs programmatically quosure @@ -119,6 +117,7 @@ testthat tibble tunnelled tunnelling +unicode utrecht vdiffr worldmap diff --git a/vignettes/oceanexplorer.Rmd b/vignettes/oceanexplorer.Rmd index 82f413d..70dafde 100644 --- a/vignettes/oceanexplorer.Rmd +++ b/vignettes/oceanexplorer.Rmd @@ -116,7 +116,7 @@ Imagine we are interested in phosphate concentrations in the month December from First, we extract the data by proving the variable, grid resolution, and the averaging period. Make sure to have an internet connection in order to connect to the NOAA server. -```{r setup, eval = curl::has_internet() && interactive()} +```{r setup, eval = curl::has_internet()} # load package library(oceanexplorer) # get data @@ -129,15 +129,15 @@ This operation can take a while, but it can be sped-up during future calls by ca Then we can plot the phosphate data from a depth of 1000 meter below sea level. -```{r plot1, fig.width=7, eval = curl::has_internet() && interactive()} +```{r plot1, fig.width=7, eval = exists("WOA")} plot_NOAA(WOA, depth = 1000) ``` -```{r save1, echo=FALSE, eval = curl::has_internet() && interactive()} +```{r save1, echo=FALSE, eval = FALSE} ggplot2::ggsave("vignettes/NOAA_plot1.png", plot_NOAA(WOA, depth = 1000), width = 9) ``` -```{r graph1, echo=FALSE, eval = !curl::has_internet() || !interactive(), out.width="100%"} +```{r graph1, echo=FALSE, eval = !exists("WOA"), out.width="100%"} knitr::include_graphics("NOAA_plot1.png") ``` @@ -145,21 +145,21 @@ knitr::include_graphics("NOAA_plot1.png") Finally, we can filter a data point from, for example, the Agulhas Basin. -```{r filter, eval = curl::has_internet() && interactive()} +```{r filter, eval = exists("WOA")} (pts <- filter_NOAA(WOA, depth = 1000, coord = list(lon = 20, lat = -46))) ``` We can then also project these extraction points on the world map for future reference. -```{r plot2, fig.width=7, eval = curl::has_internet() && interactive()} +```{r plot2, fig.width=7, eval = exists("WOA")} plot_NOAA(WOA, depth = 1000, points = pts) ``` -```{r save2, echo=FALSE, eval = curl::has_internet() && interactive()} +```{r save2, echo=FALSE, eval = FALSE} ggplot2::ggsave("vignettes/NOAA_plot2.png", plot_NOAA(WOA, depth = 1000, points = pts), width = 9) ``` -```{r graph2, echo=FALSE, eval = !curl::has_internet() || !interactive(), out.width="100%"} +```{r graph2, echo=FALSE, eval = !exists("WOA"), out.width="100%"} knitr::include_graphics("NOAA_plot2.png") ```