From 8ad363030d774536e2b9c6761dc6f25b13f8f316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 8 Oct 2024 13:22:21 +0200 Subject: [PATCH] docs: add vignette --- .Rbuildignore | 1 + DESCRIPTION | 1 + vignettes/.gitignore | 2 ++ vignettes/articles/starchart.Rmd | 47 ++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 vignettes/.gitignore create mode 100644 vignettes/articles/starchart.Rmd diff --git a/.Rbuildignore b/.Rbuildignore index d33281b..b42c98f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,4 @@ ^pkgdown$ ^man/universe_query\.Rd$ ^\.lintr$ +^vignettes/articles$ diff --git a/DESCRIPTION b/DESCRIPTION index 60b385a..777ce3e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,3 +22,4 @@ Suggests: httptest2, testthat (>= 3.0.0) Config/testthat/edition: 3 +Config/Needs/website: rmarkdown diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/articles/starchart.Rmd b/vignettes/articles/starchart.Rmd new file mode 100644 index 0000000..098ada4 --- /dev/null +++ b/vignettes/articles/starchart.Rmd @@ -0,0 +1,47 @@ +--- +title: "starchart" +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +The goal of starchart is to access the R-universe API. + +## All packages in an universe + +```{r example} +library(starchart) +universe_ls("jeroen") +``` + +## Info on all packages in an universe + +```{r} +universe_packages("jeroen", limit = 1) |> + str(max.level = 2) +``` + +## Info on a single package in an universe + +```{r} +universe_package("jeroen", package = "curl") |> + str(max.level = 2) +``` + +## Search within a single universe + +```{r} +universe_search("ropensci", query = 'needs:httr2', limit = 1) |> + str(max.level = 2) +``` + +## Search among all universes + +```{r} +global_search(query = '"weather data"', limit = 1) |> + str(max.level = 2) +```