You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,3 +41,53 @@ To install `inbodb` from GitHub, start a new R session and run this code (before
41
41
#install.packages("remotes")
42
42
remotes::install_github("inbo/inbodb")
43
43
```
44
+
45
+
# Use `inbodb`
46
+
47
+
The main function, `connect_inbo_dbase()`, makes a connection to a INBO database by simply providing the database's name as an argument (when connected to the INBO network).
48
+
After making this connection, a Connections pane in RStudio shows an overview of the INBO databases, in which database contents can be explored on clicking the icons.
49
+
50
+
The connection allows to download or query data from the database using functions of packages [DBI](https://dbi.r-dbi.org/) and [dbplyr](https://dbplyr.tidyverse.org/).
51
+
Some of the `DBI` functions have extra functionality in `inbodb`, for instance `dbDisconnect()` will also close the Connections pane in RStudio in addition to closing the connection.
52
+
Other functions may give more informative errors or (temporarily) fix small technical issues in addition to the DBI functionality, to ensure smooth access to the INBO databases.
53
+
54
+
Some code examples:
55
+
56
+
```r
57
+
# load packages
58
+
library(inbodb)
59
+
library(DBI)
60
+
61
+
# open database connection
62
+
con<- connect_inbo_dbase("D0152_00_Flora")
63
+
64
+
# read a whole table
65
+
dbReadTable(con, "Bron")
66
+
67
+
# query a database using a SQL query
68
+
dbGetQuery(con, "SELECT ID, Code, Beschrijving FROM Bron")
69
+
70
+
# compose a query using R-code and dbplyr
71
+
library(dplyr)
72
+
tbl(con, "Bron") |>
73
+
select("ID", "Code", "Beschrijving") |>
74
+
collect()
75
+
76
+
# close the connection
77
+
dbDisconnect(con)
78
+
79
+
# convert column names of an imported dataset to snake_case
80
+
janitor::clean_names(dataset)
81
+
```
82
+
83
+
As databases can be rather complex, we also wrote manuals and functions to easily retain data from some databases:
84
+
85
+
-[`Florabank`](https://www.vlaanderen.be/inbo/datasets/florabank/) (see description of [functions under 'Reference'](https://inbo.github.io/inbodb/reference/index.html))
86
+
-[`INBOveg`](https://www.vlaanderen.be/inbo/datasets/inboveg/) (see `vignette("get_data_inboveg", package = "inbodb")` and [functions](https://inbo.github.io/inbodb/reference/index.html))
87
+
-[`meetnetten.be`](https://www.vlaanderen.be/inbo/datasets/meetnettenbe/) (see `vignette("get_data_meetnetten", package = "inbodb")` and [functions](https://inbo.github.io/inbodb/reference/index.html))
88
+
-`taxonlijsten` (see `vignette("get_data_taxonlijsten", package = "inbodb")` and [functions](https://inbo.github.io/inbodb/reference/index.html))
89
+
90
+
Some other databases have functions in a dedicated R package to retain or analyse data, e.g.
0 commit comments