-
Notifications
You must be signed in to change notification settings - Fork 0
/
suleman.Rmd
97 lines (72 loc) · 2.24 KB
/
suleman.Rmd
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
title: "Pilot: SULEMAN"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Pilot: SULEMAN}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
## Install R package
```{r install, eval = FALSE}
remotes::install_github("kwb-r/kwb.pilot", upgrade = "always")
library(kwb.pilot)
```
## Define paths
### Option 1: At KWB
In `paths_list` you need to replace the dummy value `kwb-server`
for the key `servername`.
```{r paths_kwb, eval = FALSE}
#KWB server
paths_list <- list(
servername = "kwb-server",
root = "//<servername>/projekte$/WWT_Department/Projects/SULEMAN/Exchange/",
rawdata = "<root>/10_rawdata",
online = "<rawdata>/online_data",
export_dir = "//<servername>/processing/suleman"
)
paths <- kwb.utils::resolve(paths_list)
```
### Option 2: At Home
```{r paths_home, eval = FALSE}
paths_list <- list(
root = "C:/kwb/projects/suleman",
rawdata = "<root>/10_rawdata",
online = "<rawdata>/online_data",
export_dir = "<root>/export"
)
# Only execute "At Home" if not at "KWB" (i.e. KWB server path does not exist)
if(dir.exists(paths$online)) {
paths <- kwb.utils::resolve(paths_list)
}
```
## Import
```{r import, eval = FALSE}
### Recursive listing of all ".xlsx" Weintek files in rawdata directory:
files <- fs::dir_ls(paths$online,recurse = TRUE, regexp = "^[^~].*\\.xlsx$")
weintek_data_raw <- kwb.pilot::read_weintek_batch(files)
```
## Aggregate
```{r aggregate, eval = FALSE}
weintek_data_10min <- weintek_data_raw %>% kwb.pilot::group_datetime(by = 600)
weintek_data_1hour <- weintek_data_raw %>% kwb.pilot::group_datetime(by = 3600)
```
## Export
### CSV files
```{r export_data, eval = FALSE}
kwb.pilot::export_data(weintek_data_raw, export_dir = paths$export_dir)
kwb.pilot::export_data(weintek_data_10min, export_dir = paths$export_dir)
kwb.pilot::export_data(weintek_data_1hour, export_dir = paths$export_dir)
```
### Interactive HTML plots
```{r plot_data, eval = FALSE}
kwb.pilot::plot_data(weintek_data_1hour, export_dir = paths$export_dir)
kwb.pilot::plot_data(weintek_data_10min, export_dir = paths$export_dir)
#kwb.pilot::plot_data(weintek_data_raw, export_dir = paths$export_dir)
```
```