Skip to content

Commit

Permalink
Add install instructions for the r-universe
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderbl29 committed Nov 27, 2024
1 parent 4c6970d commit 7c57b5a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 30 deletions.
39 changes: 35 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7c57b5a

Please sign in to comment.