diff --git a/README.Rmd b/README.Rmd index f89bd24..bff2784 100644 --- a/README.Rmd +++ b/README.Rmd @@ -23,12 +23,43 @@ dit funktionskald. ## Installation -You can only install the development version from github, using Hadley Wickham's [devtools](http://cran.r-project.org/web/packages/devtools/index.html) package: +```{r check_cran, include=FALSE} +if (!require(available)) install.packages("available") +is_on_cran <- !available::available_on_cran("dkstat") +``` + +```{r cran_instruct, echo=FALSE, results='asis', eval=is_on_cran} +cat("You can install `{dkstat}` from CRAN with:") +``` + +```{r cran_code, eval=FALSE, include=is_on_cran} +install.packages("dkstat") +``` + +```{r r_universe_instruct, echo=FALSE, results='asis'} +if (is_on_cran) { + cat("Or you can install the latest pre-release version of `{dkstat}` from r-universe with:") +} else if (!is_on_cran) { + cat("You can install `{dkstat}` from r-universe with:") +} +``` + +```{r r_universe, eval=FALSE} +install.packages( + "dkstat", + repos = c( + ropengov = "https://ropengov.r-universe.dev", + getOption("repos") + ) +) +``` + +You can install the latest development version of `{dkstat}` from [GitHub](https://github.com/aleksanderbl29/dkstat) with: +``` r +# install.packages("devtools") +devtools::install_github("aleksanderbl29/dkstat") ``` -if(!require("devtools")) install.packages("devtools") -library("devtools") -install_github("rOpenGov/dkstat") ``` ## Examples diff --git a/README.md b/README.md index 69d22a3..27abc21 100644 --- a/README.md +++ b/README.md @@ -27,41 +27,50 @@ spørger efter i dit funktionskald. ## Installation -You can only install the development version from github, using Hadley -Wickham’s -[devtools](http://cran.r-project.org/web/packages/devtools/index.html) -package: +You can install `{dkstat}` from r-universe with: - if(!require("devtools")) install.packages("devtools") - library("devtools") - install_github("rOpenGov/dkstat") +``` r +install.packages( + "dkstat", + repos = c( + ropengov = "https://ropengov.r-universe.dev", + getOption("repos") + ) +) +``` -## Examples +You can install the latest development version of `{dkstat}` from +[GitHub](https://github.com/aleksanderbl29/dkstat) with: -The default language is danish, but have got a lang parameter that you -can change from “da” to “en” if you wan’t the data returned in English. +``` r +# install.packages("devtools") +devtools::install_github("aleksanderbl29/dkstat") +``` -### Four basic function -There are four basic functions to learn: + ## Examples -- dst_search() This function makes it possible to search through the - different tables for a word or a phrase. -- dst_tables() This function downloads all the possible tables - available. -- dst_meta() This function lets you download the meta data for a - specific table, so you can see the description, unit, variables and - values you can download data for. -- dst_get_data() lets you download the actual data you wan’t. + The default language is danish, but have got a lang parameter that you can change + from "da" to "en" if you wan't the data returned in English. -Here are a few simple examples that will go through the basics of -requesting data from the StatBank and the structure of the output. + ### Four basic function -First, we’ll load the package: + There are four basic functions to learn: -``` r -library(dkstat) -``` + - dst_search() This function makes it possible to search through the different tables for a word or a phrase. + - dst_tables() This function downloads all the possible tables available. + - dst_meta() This function lets you download the meta data for a specific table, so you can see the description, + unit, variables and values you can download data for. + - dst_get_data() lets you download the actual data you wan't. + + Here are a few simple examples that will go through the basics of requesting data from the StatBank + and the structure of the output. + + First, we'll load the package: + + + ``` r + library(dkstat) ## The search function