readtable: Table reading

Description Usage Arguments Details Value See Also

Description

These function retrieve the respective tables and views as a data frame from the database.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

Arguments

conn

Database connection.

start_datetime

Start date and time as a single POSIXct value.

end_datetime

End date and time as a single POSIXct value.

md_id

Integer vector of measurand ID.

Details

Most of the listed function retrieve present tables in the database. For convinience, function of the form dbReadTable_*_detail receive the views which join different database tables together. For example, dbReadTable_measurand_detail retrieves the measurand table with all id fields replaced by the corresponding information in physical_quantity, calibration_state, etc. Only the tables that include measurement data allow a preselection of the data to retrieve only a part of the data set.

Value

The functions return a data frame that contains the data from the respective remote table, effectively the result of calling dbGetQuery with SELECT * FROM <name>. Commands that retrieve measurement data (dbReadTable_station_*) allow a preselection of the data with start_datetime, end_datetime and md_id; all other tables are retrieved completely. An error is raised if the table does not exist. An empty table is returned as a data frame with zero rows.

See Also

dbReadTable for the general function to retrieve complete tables. dbGetQuery and http://db.rstudio.com/best-practices/run-queries-safely/ for more general SQL queries. Alternatively, you can use tbl of the dplyr package to only work on part of the database.


sebschub/klimageodb documentation built on Sept. 25, 2021, 4:16 p.m.