From 638adb1b88b3a45922a6e9ffb44b472445ede246 Mon Sep 17 00:00:00 2001 From: Reto Stauffer Date: Sun, 17 Dec 2023 20:04:30 +0100 Subject: [PATCH] fix: Updating current development version of the package --- docs/articles/lookupfunctions.html | 12 +- docs/articles/write_and_validate.html | 2 +- docs/news/index.html | 7 + docs/pkgdown.yml | 2 +- docs/reference/annex.html | 56 ++++++-- docs/reference/annex_handle_duplicates.html | 124 ++++++++++++++++ docs/reference/annex_read_stats.html | 150 ++++++++++++++++++++ docs/reference/index.html | 10 ++ docs/search.json | 2 +- docs/sitemap.xml | 6 + inst/tinytest/test_90_minimal.R | 60 ++++---- inst/tinytest/test_91_duplicate_action.R | 59 +++++--- inst/tinytest/test_92_smallN.R | 2 +- 13 files changed, 413 insertions(+), 79 deletions(-) create mode 100644 docs/reference/annex_handle_duplicates.html create mode 100644 docs/reference/annex_read_stats.html diff --git a/docs/articles/lookupfunctions.html b/docs/articles/lookupfunctions.html index 809b62c..6bdc9da 100644 --- a/docs/articles/lookupfunctions.html +++ b/docs/articles/lookupfunctions.html @@ -156,8 +156,8 @@

Variable definitionUnit conversion).

The table below shows this table in a web-table form:

-
- +
+

Room definition @@ -188,8 +188,8 @@

Room definition

The table below shows the full list in a web-table form:

-
- +
+

ISO3 country code @@ -211,8 +211,8 @@

ISO3 country code## 3 Albania AL ALB

The table below shows all 249 defined countries; searchable table.

-
- +
+

diff --git a/docs/articles/write_and_validate.html b/docs/articles/write_and_validate.html index 1c5d67b..39f488c 100644 --- a/docs/articles/write_and_validate.html +++ b/docs/articles/write_and_validate.html @@ -169,7 +169,7 @@

Where to get a user ID?Update meta information

At this point, the XLSX file -final_UIBK.xlsx +final_UIBK.xlsx does contain all the statistics, but missing the meta information.

Where additional information is needed, the XLSX sheet contains placeholders like <....> (check any of the META diff --git a/docs/news/index.html b/docs/news/index.html index b08327d..002d475 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -63,6 +63,13 @@

annex 0.2-9

  • Added an additional check in annex_prepare() to ensure that all data columns are numeric. If one of the variables provided is not numeric but only contains missing values (e.g., logical NAs) the column is converted automatically (to NA_real_). Else (not numeric or not all missing) an error will be thrown.
  • +
  • New feature: annex() has a new argument duplicate.action which allows the user to specify how he would like to handle duplicated observations (observations for the same date and time for a specific room). See ?annex section ‘Duplicates’ for details.
  • +
  • +annex_validate(..., quiet = FALSE) is now quiet.
  • +
  • Adding new function annex_read_stats() which allows to import data from one or multiple XLSX files written by annex_write_stats() (beta).
  • +
  • Removing ventilation type ‘Exhaust air’ added in 0.2-8
  • +
  • +annex_stats() returns NAs if less than 10 valid observations fall into one segment for most of the columns; annex_validate() understands that, additional test_92_smallN.R added.

annex 0.2-8

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index e0b14d2..05da809 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -12,7 +12,7 @@ articles: unitconversion: unitconversion.html visualization: visualization.html write_and_validate: write_and_validate.html -last_built: 2023-11-02T14:28Z +last_built: 2023-12-17T19:02Z urls: reference: https://some.example-url.com/reference article: https://some.example-url.com/articles diff --git a/docs/reference/annex.html b/docs/reference/annex.html index 461277c..75b81cc 100644 --- a/docs/reference/annex.html +++ b/docs/reference/annex.html @@ -70,7 +70,7 @@

Usage

-
annex(formula, data, tz, meta = NULL, verbose = FALSE)
+    
annex(formula, data, tz, duplicate.action = NULL, meta = NULL, verbose = FALSE)
 
 # S3 method for annex
 head(x, ...)
@@ -108,9 +108,15 @@ 

ArgumentsDetails

The latter allows to process observations from different studies, homes, and/or rooms all in one go.

+
+

Duplicates

+ + + +

Duplicated records can distort the statistics and should be handled properly. +For each unique study, home, room only one observation (row) for a specific +date and time should exist.

+

As there is no general way to deal with such duplicates, the function annex +(as well as annex_prepare) by default throws a warning for the user if such +duplicates exist (duplicate.action = NULL; default argument).

+

However, the package allows the user to provide a custom duplicate.action +function, e.g., mean, min, max, ... This function must return +one single numeric value (or an NA) when applied to a vector. If a function is provided, +the annex function does the following:

  • Checks if there are any duplicates. If not, no changes are made. Else ...

  • +
  • Checking if the function is valid (returns single numeric or NA). If not, +an error will be thrown.

  • +
  • Takes the measurements of each duplicate; if all values are missing, +an NA will be returned. Else the users duplicate.action is applied +to all remaining non-missing values. I.e., if duplicate.action = mean +the average of all non-missing values will be used.

  • +

See also

annex_prepare, annex_stats

@@ -167,9 +195,9 @@

Examples tz = "Europe/Berlin") head(res1, n = 3) #> datetime study room home year month tod T RH -#> 1 2021-12-31 14:00:00 example BED ex 2021 12 07-23 21.90 94.09 -#> 2 2021-12-31 15:00:00 example BED ex 2021 12 07-23 20.03 47.23 -#> 3 2021-12-31 16:00:00 example BED ex 2021 12 07-23 19.99 72.39 +#> 1 2021-12-31 14:00:00 example BED ex 2021 12 07-23 21.81 80.27 +#> 2 2021-12-31 15:00:00 example BED ex 2021 12 07-23 17.71 78.26 +#> 3 2021-12-31 16:00:00 example BED ex 2021 12 07-23 20.29 46.02 # The meta information can also be added to `data` removing the need # to specify the `meta` argument and allows to mix data from different @@ -180,19 +208,19 @@

Examples room = "BED") head(data) #> datetime T RH study home room -#> 1 2021-12-31 14:00:00 21.90 94.09 example ex BED -#> 2 2021-12-31 15:00:00 20.03 47.23 example ex BED -#> 3 2021-12-31 16:00:00 19.99 72.39 example ex BED -#> 4 2021-12-31 17:00:00 19.63 54.65 example ex BED -#> 5 2021-12-31 18:00:00 17.69 44.53 example ex BED -#> 6 2021-12-31 19:00:00 21.12 98.15 example ex BED +#> 1 2021-12-31 14:00:00 21.81 80.27 example ex BED +#> 2 2021-12-31 15:00:00 17.71 78.26 example ex BED +#> 3 2021-12-31 16:00:00 20.29 46.02 example ex BED +#> 4 2021-12-31 17:00:00 15.94 70.27 example ex BED +#> 5 2021-12-31 18:00:00 19.61 99.26 example ex BED +#> 6 2021-12-31 19:00:00 18.72 55.28 example ex BED res2 <- annex(T + RH ~ datetime | study + home + room, data = data, tz = "Europe/Berlin") head(res2, n = 3) #> datetime study home room year month tod T RH -#> 1 2021-12-31 14:00:00 example ex BED 2021 12 07-23 21.90 94.09 -#> 2 2021-12-31 15:00:00 example ex BED 2021 12 07-23 20.03 47.23 -#> 3 2021-12-31 16:00:00 example ex BED 2021 12 07-23 19.99 72.39 +#> 1 2021-12-31 14:00:00 example ex BED 2021 12 07-23 21.81 80.27 +#> 2 2021-12-31 15:00:00 example ex BED 2021 12 07-23 17.71 78.26 +#> 3 2021-12-31 16:00:00 example ex BED 2021 12 07-23 20.29 46.02

diff --git a/docs/reference/annex_handle_duplicates.html b/docs/reference/annex_handle_duplicates.html new file mode 100644 index 0000000..6e9da59 --- /dev/null +++ b/docs/reference/annex_handle_duplicates.html @@ -0,0 +1,124 @@ + +Internal Function for Handling Possible Duplicates — annex_handle_duplicates • annex + Skip to contents + + +
+
+
+ +
+

This function is called inside annex().

+
+ +
+

Usage

+
annex_handle_duplicates(x, formula, duplicate.action, verbose = FALSE)
+
+ +
+

Arguments

+
x
+

data.frame to be processed.

+ + +
formula
+

object of class Formula, the formula provided to annex().

+ + +
duplicate.action
+

can be NULL (no dedicated handling for duplicates) +of a function. If function it must return a single numeric value, +will be tested to be able to provide a useful error for the user if needed.

+ + +
verbose
+

logical, verbosity (defaults to FALSE).

+ +
+
+

Value

+ + +

Returns a data.frame similar to argument x with possibly +modified content (depending on how to deal with duplicates if any).

+
+
+

Author

+

Reto

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/annex_read_stats.html b/docs/reference/annex_read_stats.html new file mode 100644 index 0000000..a635ea5 --- /dev/null +++ b/docs/reference/annex_read_stats.html @@ -0,0 +1,150 @@ + +Reading Annex Statistics from XLSX — annex_read_stats • annex + Skip to contents + + +
+
+
+ +
+

The final data set (annex statistics) are written into an XLSX +file. This function allows to read one or multiple of these files +into R.

+
+ +
+

Usage

+
annex_read_stats(file, raw = FALSE, validate = TRUE)
+
+ +
+

Arguments

+
file
+

character, name of the file(s) to be imported. +Must end on XLSX (not case sensitive).

+ + +
raw
+

logical. If FALSE a single data.frame +will be returned, containing the statistics from +all file(s). If set TRUE the raw information +of the XLSX file(s) is returned (see Details).

+ + +
validate
+

logical, if TRUE (default) the function +first validates if the XLSX file is valid given the current +version of annex.

+ +
+
+

Value

+ + +

An object of class c("annex_xlsx_stats", "data.frame")

+ + +

or a named list of data.frames. Depends argument raw, +see section 'Details'.

+
+
+

Details

+

The XLSX files (if valid) contain a series of sheets, +namely 'STATS', 'META-Study', 'META-Home', 'META-Room', and +'META-Variable' containing data information. This function +has two different returns (depending on combine).

+

If raw = FALSE (default) only the 'STAT' sheet is +imported. If there is more than one file the information +from all files will be combined in one data.frame which +is returned.

+

If raw = TRUE all the information from all sheets is +read and stored in a named list. If there are multiple files, +the content of the different sheets are combined. The return +is a named list of length 5 containing a data.frame each. +For usability purposes the sheet names will be modified, +replacing "-" (XLSX) with "_" (names of list).

+
+
+

Author

+

Reto Stauffer

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 1d7e9fc..e95778a 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -102,6 +102,11 @@

All functionsannex_handle_duplicates() + +
Internal Function for Handling Possible Duplicates
+
+ annex_parse_formula()
Parsing Formula
@@ -112,6 +117,11 @@

All functionsannex_read_stats() + +
Reading Annex Statistics from XLSX
+

+ annex_room_definition()
Room definition information
diff --git a/docs/search.json b/docs/search.json index cb63127..e4aeca9 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Calculate statistics","text":"data prepared, analysis can performed. article continues example used article Prepare data XLSX works way examples included documentation, e.g., Prepare data textfiles. Please look article information following lines code /get \"demo_UIBK.xlsx\" file follow article.","code":"library(\"readxl\") # Importing data and config object (meta information) raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Custom subsetting # Prepare data for annex() library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df, n = 3) ## datetime study home room RH SolRad T CO2 Other ## 1 2011-10-01 00:05:00 demo General AMB 88.4 3 13.35 NA NA ## 2 2011-10-01 00:10:00 demo General AMB 88.9 3 13.25 NA NA ## 3 2011-10-01 00:15:00 demo General AMB 89.2 3 13.17 NA NA"},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"performing-the-analysis","dir":"Articles","previous_headings":"","what":"Performing the analysis","title":"Calculate statistics","text":"data set prepared properly (note annex_prepare() convenience function, can also done manually) final object can prepared.","code":""},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"prepare-annex-object","dir":"Articles","previous_headings":"Performing the analysis","what":"Prepare annex object","title":"Calculate statistics","text":"annex() creator function creates object class annex (S3) providing series methods functions conduct final analysis. information object orientation system S3 can found e.g. function expects formula input describes process data. three parts formula : ~ | first part defines variables (measurements) processed Part two always ~ datetime; date time information statistics Part three grouping, typically study + home + room series S3 methods exist annex objects might extended future. summary() head()/tail() .regular() plot()","code":"annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") head(annex_df) ## datetime study home room year month tod RH T CO2 ## 1 2011-10-01 00:05:00 demo General AMB 2011 10 23-07 88.4 13.35 NA ## 2 2011-10-01 00:10:00 demo General AMB 2011 10 23-07 88.9 13.25 NA ## 3 2011-10-01 00:15:00 demo General AMB 2011 10 23-07 89.2 13.17 NA ## 4 2011-10-01 00:20:00 demo General AMB 2011 10 23-07 90.2 13.00 NA ## 5 2011-10-01 00:25:00 demo General AMB 2011 10 23-07 90.9 12.86 NA ## 6 2011-10-01 00:30:00 demo General AMB 2011 10 23-07 90.7 12.80 NA class(annex_df) ## [1] \"annex\" \"data.frame\""},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"calculating-statistics","dir":"Articles","previous_headings":"Performing the analysis","what":"Calculating statistics","title":"Calculate statistics","text":"Based object returned annex() analysis can performed calling annex_stats(). function aggregates data based formula provided , calculates series statistical properties, returns object class annex_stats. default, argument format set \"wide\" return statistics wide format, .e. calculated values columns format = \"long\" create one line every calculated value. chosen format (long wide) matter analysis particular format may convenient processed manually.","code":"head(annex_df) ## datetime study home room year month tod RH T CO2 ## 1 2011-10-01 00:05:00 demo General AMB 2011 10 23-07 88.4 13.35 NA ## 2 2011-10-01 00:10:00 demo General AMB 2011 10 23-07 88.9 13.25 NA ## 3 2011-10-01 00:15:00 demo General AMB 2011 10 23-07 89.2 13.17 NA ## 4 2011-10-01 00:20:00 demo General AMB 2011 10 23-07 90.2 13.00 NA ## 5 2011-10-01 00:25:00 demo General AMB 2011 10 23-07 90.9 12.86 NA ## 6 2011-10-01 00:30:00 demo General AMB 2011 10 23-07 90.7 12.80 NA stats <- annex_stats(annex_df, format = \"long\") head(stats) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 ## 3 demo General AMB 2011 10 all RH quality_start 15248 ## 4 demo General AMB 2011 10 all RH quality_end 15253 ## 5 demo General AMB 2011 10 all RH interval_Min 300 ## 6 demo General AMB 2011 10 all RH interval_Q1 300"},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"next-steps","dir":"Articles","previous_headings":"Performing the analysis","what":"Next steps","title":"Calculate statistics","text":"calculating statistics, following steps can performed: Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Config file/objects","text":"make pre-processing data analysis user-friendly easier automatize, annex package provides configuration feature. Technically just regular data.frame used lookup table bring data expected format can come source (e.g., text file, XLSX file, created via script, …).","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"configuration-content-and-purpose","dir":"Articles","previous_headings":"","what":"Configuration content and purpose","title":"Config file/objects","text":"following output shows first n = 6 lines configuration object used article Prepare data textfiles; first six lines data.frame \\(6\\) variables (columns). used tell annex package information needs processed, find important information, translate (rename) variables meet annex standard format.","code":"head(config, n = 6) ## column variable study unit home room ## 1 X datetime ## 2 co2 CO2 DEMO_STUD ppm Casa_Blanca Bed1 ## 3 humidity rH DEMO_STUD % Casa_Blanca Bed1 ## 4 pressure Pressure DEMO_STUD hPa Casa_Blanca Bed1 ## 5 temp T DEMO_STUD C Casa_Blanca Bed1 ## 6 voc VOC DEMO_STUD ug/m3 Casa_Blanca Bed1"},{"path":"https://some.example-url.com/articles/config.html","id":"the-six-required-columns","dir":"Articles","previous_headings":"Configuration content and purpose","what":"The six required columns","title":"Config file/objects","text":"column: name column imported data set (e.g., XLSX file text file). variable: Defines new variable name; one different variables (parameters) expected annex package (see Variable definition). study: Name study data belong . home: Name home (building) data belong . room: Abbreviation type room data belong (see Room definition). unit: Units input data (raw data); annex_prepare() automatically convert ’annex standard units (see Variable definition). column, study home can chosen freely user, series pre-defined values available variable (plus unit) room (case sensitive). See Lookup functions get full list defined values.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"the-required-rows","dir":"Articles","previous_headings":"Configuration content and purpose","what":"The required rows","title":"Config file/objects","text":"one required row must exist one defines date time information can found. row defines variable \"datetime\" located imported data set (case variable called \"X\"). rows specify column imported data set contains information processed. Variables listed configuration (available imported data set) ignored processing steps (namely calling annex_prepare()).","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"purpose","dir":"Articles","previous_headings":"Configuration content and purpose","what":"Purpose","title":"Config file/objects","text":"purpose object prepare imported data set object expected annex package analysis saving data later use. used define required information stored used lookup table (translation table) prepare/rename variables, format data according annex standard format used processing steps.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"readimport-configuration","dir":"Articles","previous_headings":"","what":"Read/import configuration","title":"Config file/objects","text":"two articles Prepare data XLSX Prepare data textfiles show examples import (read) configuration XLSX file text file. file can imported data.frame via R can used.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"technical-note","dir":"Articles","previous_headings":"","what":"Technical note","title":"Config file/objects","text":"Note configuration convenience feature. Technically can bypassed preparing data set outside annex starting analysis.","code":""},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare data from textfiles","text":"article explains import process data annex package require data available tabular text files (CSV). demonstrate , two files used called demo_Bedroom.txt (contains measurement data) well demo_Bedroom_config.TXT (contains configuration; see article Config file). files can easily read using base R functions, namely read.table() interfacing functions like read.csv(), utils::read.delim() etc. (see ?read.table details).","code":""},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"reading-the-data","dir":"Articles","previous_headings":"","what":"Reading the data","title":"Prepare data from textfiles","text":"first step import () measurement data (stored raw_df) (ii) configuration (stored config): objects class data.frame (tibble data frames precise) dimension \\(51890 \\times 8\\) (raw_df) \\(7 \\times 6\\) (config) respectively. first observations (rows) two objects look follows: object raw_df contains variables (columns) named “X”, “radonShortTermAvg”, “temp”, “humidity” original names XLSX sheet, config object contains definition columns raw_df contains belong . details read article Config file.","code":"raw_df <- read.csv(\"demo_Bedroom.txt\") config <- read.table(\"demo_Bedroom_config.TXT\", comment.char = \"#\", sep = \"\", header = TRUE, na.strings = c(\"NA\", \"empty\")) # see ?read.table for details # Class and dimension of the objects c(\"raw_df\" = is.data.frame(raw_df), \"config\" = is.data.frame(config)) ## raw_df config ## TRUE TRUE cbind(\"raw_df\" = dim(raw_df), \"config\" = dim(config)) ## raw_df config ## [1,] 51890 7 ## [2,] 8 6 head(raw_df[, 1:4], n = 3) # First three columns only ## X radonShortTermAvg temp humidity ## 1 2011-01-01 00:01:26 151 18.8 51 ## 2 2011-01-01 00:06:25 151 18.8 51 ## 3 2011-01-01 00:11:25 151 18.8 51 head(config, n = 3) ## column variable study unit home room ## 1 X datetime ## 2 co2 CO2 DEMO_STUD ppm Casa_Blanca Bed1 ## 3 humidity rH DEMO_STUD % Casa_Blanca Bed1"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"checking-the-config-object","dir":"Articles","previous_headings":"Reading the data","what":"Checking the config object","title":"Prepare data from textfiles","text":"check whether config object expected annex package, function annex_check_config() can used. case problems detected, error thrown (see Config file). Else, function silent example: … errors, config object meets annex requirements. Note step necessary performed automatically calling annex_prepare() can handy development.","code":"library(\"annex\") annex_check_config(config)"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"preparing-data","dir":"Articles","previous_headings":"","what":"Preparing data","title":"Prepare data from textfiles","text":"raw_df contains raw data set, config object contains information rename columns observations belong . prepare_annex() helper function prepare data set steps. moment get error variable containing date time information proper datetime object (object class POSIXt) character. information comes proper ISO format, simply convert column (column X raw_df) call annex_prepare() . annex_prepare() performs series tasks: Checking config object (calls annex_check_config() internally). config object valid, variables (columns) raw_df renamed checked correct class, informs user columns raw_df included config (just note) additional columns defined config occur raw_df, returns modified (possibly subsetted) object, ensures datetime proper datetime object (POSIXt). checks missing/additional definitions config intended inform user possible misspecifications result error.","code":"prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) ## [1] \"datetime\" \"study\" \"home\" \"room\" \"CO2\" \"Pressure\" ## [7] \"Radon\" \"RH\" \"T\" \"VOC\" ## Error in annex_prepare(raw_df, config, quiet = TRUE): variable `datetime` (originally column `X`) must be of class POSIXt # see ?as.POSIXct for details and options raw_df <- transform(raw_df, X = as.POSIXct(X, tz = \"UTC\")) class(raw_df$X) ## [1] \"POSIXct\" \"POSIXt\" prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df) ## datetime study home room CO2 Pressure Radon RH T VOC ## 1 2011-01-01 00:01:26 DEMO_STUD Casa_Blanca BED1 470 1026.5 151 51 18.8 136 ## 2 2011-01-01 00:06:25 DEMO_STUD Casa_Blanca BED1 477 1026.5 151 51 18.8 142 ## 3 2011-01-01 00:11:25 DEMO_STUD Casa_Blanca BED1 483 1026.5 151 51 18.8 131 ## 4 2011-01-01 00:16:25 DEMO_STUD Casa_Blanca BED1 477 1026.5 151 51 18.8 140 ## 5 2011-01-01 00:21:25 DEMO_STUD Casa_Blanca BED1 481 1026.4 151 51 18.8 135 ## 6 2011-01-01 00:26:25 DEMO_STUD Casa_Blanca BED1 483 1026.4 168 51 18.7 131"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare data from textfiles","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare data from XLSX","text":"article explains import process data annex package required data available XLSX format. purpose, demo data set called demo_UIBK.xlsx used (shipped package) contains two sheets: measurements: data (e.g., logger pre-processed) annex_configuration: Configuration (see article Config file) Save demo file /xlsx data file R working directory. Importing data R user, annex package provide import functionality. XLSX files multitude R packages exist; article making use readxl package, however, package allows read data XLSX files return object class data.frame work well.","code":""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"reading-the-data","dir":"Articles","previous_headings":"","what":"Reading the data","title":"Prepare data from XLSX","text":"first step import () measurement data (stored raw_df) (ii) configuration (stored config): objects class data.frame (tibble data frames precise) dimension \\(1500 \\times 106\\) (raw_df) \\(106 \\times 7\\) (config) respectively. first observations (rows) two objects look follows: object raw_df contains variables (columns) named “Zeitraum ab”, “T-WZ_W1 [°C] avg”, “rH-WZ_W1 [% rH] avg” original names XLSX sheet, config object contains definition columns raw_df contains belong . details read article Config file. variable config$process custom column containing logical value whether column used processing. like process rows config$proces == TRUE. config pure data.frame, subsetting can used.","code":"library(\"readxl\") raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") # Class and dimension of the objects c(\"raw_df\" = is.data.frame(raw_df), \"config\" = is.data.frame(config)) ## raw_df config ## TRUE TRUE cbind(\"raw_df\" = dim(raw_df), \"config\" = dim(config)) ## raw_df config ## [1,] 1500 106 ## [2,] 106 7 head(raw_df[, 1:3], n = 3) # First three columns only ## # A tibble: 3 × 3 ## `Zeitraum ab` `T-WZ_W1 [°C] avg` `rH-WZ_W1 [% rH] avg` ## ## 1 2011-10-01 00:05:00 22.6 55.6 ## 2 2011-10-01 00:10:00 22.6 55.5 ## 3 2011-10-01 00:15:00 22.6 55.4 head(config, n = 3) ## # A tibble: 3 × 7 ## process column variable unit study home room ## ## 1 1 Zeitraum ab datetime NA NA NA NA ## 2 1 T-WZ_W1 [°C] avg T C demo W1 LIV ## 3 1 rH-WZ_W1 [% rH] avg rH % demo W1 LIV config <- subset(config, process == TRUE) # Remove all rows process = FALSE"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"checking-the-config-object","dir":"Articles","previous_headings":"Reading the data","what":"Checking the config object","title":"Prepare data from XLSX","text":"check whether config object expected annex package, function annex_check_config() can used. case problems detected, error thrown (see Config file). Else, function silent example: … errors, config object meets annex requirements. Note step necessary performed automatically calling annex_prepare() can handy development.","code":"library(\"annex\") annex_check_config(config)"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"preparing-data","dir":"Articles","previous_headings":"","what":"Preparing data","title":"Prepare data from XLSX","text":"Based raw_df still contains raw data set read XLSX file config object information renaming (columns used), data set processing can created. annex_prepare() performs series tasks: Checking config object (calls annex_check_config() internally). config object valid, variables (columns) raw_df renamed checked correct class, informs user columns raw_df included config (just note) additional columns defined config occur raw_df, returns modified (possibly subsetted) object, ensures datetime proper datetime object (POSIXt). checks missing/additional definitions config intended inform user possible misspecifications result error.","code":"prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df) ## datetime study home room RH SolRad T CO2 Other ## 1 2011-10-01 00:05:00 demo General AMB 88.4 3 13.35 NA NA ## 2 2011-10-01 00:10:00 demo General AMB 88.9 3 13.25 NA NA ## 3 2011-10-01 00:15:00 demo General AMB 89.2 3 13.17 NA NA ## 4 2011-10-01 00:20:00 demo General AMB 90.2 3 13.00 NA NA ## 5 2011-10-01 00:25:00 demo General AMB 90.9 3 12.86 NA NA ## 6 2011-10-01 00:30:00 demo General AMB 90.7 3 12.80 NA NA"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"ensure-correct-date-and-time-timezone","dir":"Articles","previous_headings":"","what":"Ensure correct date and time (timezone)","title":"Prepare data from XLSX","text":"Note: read_excel() (readxl) package may automartically detect convert date time information POSIXct (date time object), however, Excel notion timezones, information returned always UTC! Investigate class time zone attribute attached: enforce different time zone (assuming data recorded time zone different UTC) one need acoerce information back character without time zone information (using format()) back POSIXct allows set correct time zone. demonstration (show command) convert information ‘US/Central’ back ‘UTC’. time zone conversion can also done raw_df object (needed) needs addressed calling annex() (see Calculating statistics (analysis)) ensure information processed properly.","code":"class(prepared_df$datetime) # Class of our first variable (Zeitraum ab) ## [1] \"POSIXct\" \"POSIXt\" attr(prepared_df$datetime, \"tzone\") # Time zone used ## [1] \"UTC\" head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 UTC\" \"2011-10-01 00:10:00 UTC\" # Coerce to 'US/Central' prepared_df$datetime <- as.POSIXct(format(prepared_df$datetime), tz = \"US/Central\") head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 CDT\" \"2011-10-01 00:10:00 CDT\" attr(prepared_df$datetime, \"tzone\") ## [1] \"US/Central\" # Coerce back to 'UTC' prepared_df$datetime <- as.POSIXct(format(prepared_df$datetime), tz = \"UTC\") head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 UTC\" \"2011-10-01 00:10:00 UTC\" attr(prepared_df$datetime, \"tzone\") ## [1] \"UTC\""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare data from XLSX","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Lookup functions/definitions","text":"package using series ‘lookup tables’ data sets validate correctness data. includes testing config object correct format validate XLSX file. case problems found, error messages, warnings, notes include hints going wrong. series small helper functions exist allow user get definitions used internally kind tests.","code":""},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"variable-definition","dir":"Articles","previous_headings":"","what":"Variable definition","title":"Lookup functions/definitions","text":"annex_variable_definition() returns data.frame (list) containing names allowed variables well additional information. name: Name variable (used column variable config object) required: Whether additional variable information required (used annex_validate()) lower: Lower bound; observations threshold considered bad quality. Used calculate quality_lower annex_stats(). NA bound defined. upper: Upper bound; observations threshold considered bad quality. Used calculate quality_upper annex_stats(). NA bound defined. allowed_units: Comma separated list allowed units needed config object NA defined. set, first entry ‘annex standard unit’ (see also Unit conversion). table shows table web-table form:","code":"require(\"annex\") ## Loading required package: annex var_def <- annex_variable_definition() head(var_def, n = 3) ## name required lower upper allowed_units ## 1 CO2 FALSE 350 10000 ppm, % ## 2 CO FALSE 0 100 ug/m3, mg/m3, ppm, ppb ## 3 HCHO FALSE 0 1000 ug/m3, mg/m3, ppm, ppb"},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"room-definition","dir":"Articles","previous_headings":"","what":"Room definition","title":"Lookup functions/definitions","text":"annex_room_definition() returns data.frame containing names allowed room definitions. allowed room type base name (e.g., \"BED\"; Bedroom) can extended adding two numeric digits. allows define multiple bedrooms needed (see examples_valid_labels included ). labels used config object. name: Base name/base abbreviation available room types. long_name: Human readable description. examples_valid_labels: Examples allowed names label multiple rooms type within one home. table shows full list web-table form:","code":"require(\"annex\") room_def <- annex_room_definition() head(room_def, n = 3) ## name long_name examples_valid_labels ## 1 AMB Ambient AMB, AMB1, AMB2, AMB25 ## 2 BED Bedroom BED, BED1, BED2, BED25 ## 3 LIV Living room LIV, LIV1, LIV2, LIV25"},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"iso3-country-code","dir":"Articles","previous_headings":"","what":"ISO3 country code","title":"Lookup functions/definitions","text":"output XLSX file (sheet “META-home”) user needs specify country (location) ‘home’ using ISO3 (ISO3166 alpha-3) country codes. list available country codes shipped annex package can accessed using annex_countries(). information used validating output XLSX (see Write validate). table shows 249 defined countries; searchable table.","code":"require(\"annex\") iso3_def <- annex_countries() head(iso3_def, n = 3) ## country ISO2 ISO3 ## 1 Afghanistan AF AFG ## 2 Åland Islands AX ALA ## 3 Albania AL ALB"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare with time zones & units","text":"article shows import prepare data set calculate annex statistics, focusing following two aspects: Time zone: deal time zones Unit conversion: Automatically convert units observations. demonstration file called demo_US.xlsx used already contains two sheets, one contains simulated observations, one containing configuration (meta info) allows translate data ‘observations sheet’ object required annex(). Please also look two articles Prepare data XLSX Prepare data textfiles examples.","code":""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"scenario-1","dir":"Articles","previous_headings":"","what":"Scenario (1)","title":"Prepare with time zones & units","text":"Imagine got observations logger recording date time “US/Central” (CST) time contains data four different sensors: Kitchen room temperature (indoor); Fahrenheit Kitchen relative humidity (indoor); unit (0.0 1.0) exhaust temperature (heating system); degrees Celsius Ambient air pressure; mmHg (millimetre mercury)","code":""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"reading-the-data","dir":"Articles","previous_headings":"Scenario (1)","what":"Reading the data","title":"Prepare with time zones & units","text":"Step one import data; using readxl package : quick look first \\(3\\) observations (rows) object raw_df shows got variable loggertime seems contain date time observation US format (mm/dd/yyyy HH:MM:SS) know represents date time “US/Central” time. However, looking class variable raw_df$loggertime can see class character (chr; text) wherefore need properly convert making use . addition, simulated data set contains periods missing data well periods single sensors report data shown later.","code":"library(\"readxl\") excel_sheets(\"demo_US.xlsx\") # Checking sheet names ## [1] \"meta_config\" \"airquality_data\" # Reading observations raw_df <- read_excel(\"demo_US.xlsx\", sheet = \"airquality_data\") raw_df <- as.data.frame(raw_df) # Convert to simple data.frame # Reading configuration config <- read_excel(\"demo_US.xlsx\", sheet = \"meta_config\") config <- as.data.frame(config) # Convert to simple data.frame head(raw_df, n = 3) ## loggertime temperature.kitchen rel.hum.kitchen ## 1 12/28/2028 06:30:00 72.01654 0.89 ## 2 12/28/2028 06:40:00 72.31357 0.96 ## 3 12/28/2028 06:50:00 72.49413 0.75 ## exhaust.temperature..Cels. air.pressure ## 1 47.24872 675.4629 ## 2 46.95983 676.5550 ## 3 46.62533 676.1809 class(raw_df$loggertime) ## [1] \"character\""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"convert-loggertime","dir":"Articles","previous_headings":"Scenario (1)","what":"Convert loggertime","title":"Prepare with time zones & units","text":"convert date time information proper datetime object (object class POSIXct) including proper time zone, can call .POSIXct(). Arguments: x: character vector raw_df$loggertime right now object. format: format date time information (see ?strftime get list available options). tz: Time zone definition. Can long format (e.g., \"US/Central\") short (e.g., \"CST\"). Call OlsonNames() get list time zones (long format). step important ensure annex() later knows interpret date time information aggregation. Note time zone raw data time zone calculating statistics can different.","code":"# Convert and overwrite existing column raw_df$loggertime <- as.POSIXct(x = raw_df$loggertime, format = \"%m/%d/%Y %H:%M:%S\", tz = \"US/Central\") # Checking the variable head(raw_df$loggertime) ## [1] \"2028-12-28 06:30:00 CST\" \"2028-12-28 06:40:00 CST\" ## [3] \"2028-12-28 06:50:00 CST\" \"2028-12-28 07:00:00 CST\" ## [5] \"2028-12-28 07:10:00 CST\" \"2028-12-28 07:20:00 CST\" attr(raw_df$loggertime, \"tz\") # Shows time zone abbreviation ## [1] \"US/Central\""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"the-config-object","dir":"Articles","previous_headings":"Scenario (1)","what":"The config object","title":"Prepare with time zones & units","text":"Next, let us look config object. described detail Config file/objects object contains information interpret raw data set. shown, unit column defines one temperature recorded Fahrenheit (unit = \"F\"), relative humidity without unit (unit = \"-\"), air pressure millimeter mercury (unit = 'mmHg') raw data. becomes important later calling annex_prepare().","code":"config ## column variable study home room unit ## 1 loggertime datetime demo_US top_flat ## 2 temperature.kitchen T demo_US top_flat KIT F ## 3 rel.hum.kitchen RH demo_US top_flat KIT - ## 4 exhaust.temperature..Cels. T demo_US top_flat EHA C ## 5 air.pressure Pressure demo_US top_flat AMB mmHg"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"data-overview","dir":"Articles","previous_headings":"Scenario (1)","what":"Data overview","title":"Prepare with time zones & units","text":"better understand happens let us quick look data. summary() returns five number summary plus arithmetic mean variables raw_df object. shown, observations kitchen temperature (second variable) mean NA corresponds 20 degrees Celsius. average relative humidity NA corresponds NA percent. Alternatively can quickly convert raw_df time series object (now loggertime prepared correctly) check data visually clearly shows gaps data:","code":"summary(raw_df) ## loggertime temperature.kitchen rel.hum.kitchen ## Min. :2028-12-28 06:30:00.00 Min. :60.49 Min. :0.3300 ## 1st Qu.:2028-12-29 12:20:00.00 1st Qu.:62.86 1st Qu.:0.8200 ## Median :2028-12-31 09:00:00.00 Median :67.93 Median :0.8900 ## Mean :2028-12-31 03:55:05.44 Mean :68.00 Mean :0.8928 ## 3rd Qu.:2029-01-01 14:50:00.00 3rd Qu.:73.15 3rd Qu.:0.9600 ## Max. :2029-01-03 00:20:00.00 Max. :75.72 Max. :1.1000 ## NA's :8 NA's :33 ## exhaust.temperature..Cels. air.pressure ## Min. :39.52 Min. :647.8 ## 1st Qu.:40.16 1st Qu.:677.2 ## Median :42.38 Median :680.1 ## Mean :46.10 Mean :678.8 ## 3rd Qu.:52.08 3rd Qu.:685.4 ## Max. :60.20 Max. :701.2 ## NA's :376 library(\"zoo\") raw_zoo <- zoo(raw_df[, -1], raw_df[, 1]) plot(raw_zoo)"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"prepare-the-data","dir":"Articles","previous_headings":"Scenario (1)","what":"Prepare the data","title":"Prepare with time zones & units","text":"can now use raw_df combination config object prepare data next step. step, units automatically converted (variables conversion defined). function also reshapes data, however, one can see temperature data (contains temperature data exhaust well kitchen) now degrees Celsius; relative humidity automatically converted percent.","code":"library(\"annex\") prepared_df <- annex_prepare(raw_df, config) head(prepared_df) ## datetime study home room Pressure T RH ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 900.5433 NA NA ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 901.9993 NA NA ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 901.5005 NA NA ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 904.6508 NA NA ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 905.8652 NA NA ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 903.9762 NA NA summary(prepared_df) ## datetime study home ## Min. :2028-12-28 06:30:00.00 Length:2151 Length:2151 ## 1st Qu.:2028-12-29 12:20:00.00 Class :character Class :character ## Median :2028-12-31 09:00:00.00 Mode :character Mode :character ## Mean :2028-12-31 03:55:05.44 ## 3rd Qu.:2029-01-01 14:50:00.00 ## Max. :2029-01-03 00:20:00.00 ## ## room Pressure T RH ## Length:2151 Min. :863.7 Min. :15.83 Min. : 33.00 ## Class :character 1st Qu.:902.8 1st Qu.:20.03 1st Qu.: 82.00 ## Mode :character Median :906.7 Median :39.57 Median : 89.00 ## Mean :904.9 Mean :33.12 Mean : 89.28 ## 3rd Qu.:913.8 3rd Qu.:42.39 3rd Qu.: 96.00 ## Max. :934.9 Max. :60.20 Max. :110.00 ## NA's :1810 NA's :725 NA's :1467"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"calculating-statistics","dir":"Articles","previous_headings":"Scenario (1)","what":"Calculating statistics","title":"Prepare with time zones & units","text":"data set prepared, annex() can called prepare data set final calculations. Note: far, date time information still time zone logger. calling annex() can specify time zone statistics calculated. Correct solution: According scenario know study area located “US/Central” time zone. need tell annex() correctly conversion. shown, first three observations (7 local time) fall period tod = \"23-07\" next ones fall period tod = \"07-23\".","code":"annex_df <- annex(T + RH + Pressure ~ datetime | study + home + room, data = prepared_df, tz = \"US/Central\") head(annex_df) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 07-23 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 07-23 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 07-23 NA NA 903.9762"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"scenario-2","dir":"Articles","previous_headings":"","what":"Scenario (2)","title":"Prepare with time zones & units","text":"illustration, let us imagine situation study located US/Central time zone, however, imagine loggertime reported UTC. Thus, needed () convert loggertime UTC, keep analysis steps relative US/Central time zone (calling annex()). comparing first six observations (rows) object annex_df (handled US/Central time) annex_UTC (raw data UTC, processing US/Central) one can see difference tod variable (also affects year month) …","code":"# Re-reading the original data set; Store it on a new object raw_UTC raw_UTC <- read_excel(\"demo_US.xlsx\", sheet = \"airquality_data\") # Convert loggertime; this time with 'tz = \"UTC\"' raw_UTC$loggertime <- as.POSIXct(x = raw_UTC$loggertime, format = \"%m/%d/%Y %H:%M:%S\", tz = \"UTC\") # Prepare the data relative to US/Central; same 'config' object as before prepared_UTC <- annex_prepare(raw_UTC, config) annex_UTC <- annex(T + RH + Pressure ~ datetime | study + home + room, data = prepared_UTC, tz = \"US/Central\") head(annex_df) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 07-23 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 07-23 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 07-23 NA NA 903.9762 head(annex_UTC) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 23-07 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 23-07 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 23-07 NA NA 903.9762"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare with time zones & units","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/unitconversion.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Unit conversion","text":"TODO(R): Yet written.","code":""},{"path":"https://some.example-url.com/articles/visualization.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Visualization (plotting)","text":"package comes simple default plots annex objects (returned annex()). following demonstration based example shown article Prepare data XLSX, using file demo_UIBK.xlsx (please read Prepare data XLSX details).","code":"library(\"readxl\") # Reading measurement data raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") # Read and prepare config object config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Remove all rows process = FALSE # Prepare annex object library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") dim(annex_df) ## [1] 43500 10 class(annex_df) ## [1] \"annex\" \"data.frame\""},{"path":"https://some.example-url.com/articles/visualization.html","id":"plotting","dir":"Articles","previous_headings":"Introduction","what":"Plotting","title":"Visualization (plotting)","text":"prepared, can call default (base R) plotting methods: Additional arguments start end can given (either objects class POSIXt characters ISO format) plot specific time period.","code":"plot(annex_df) plot(annex_df, start = \"2011-10-03\", end = \"2011-10-04\")"},{"path":"https://some.example-url.com/articles/visualization.html","id":"using-ggplot2","dir":"Articles","previous_headings":"Introduction","what":"Using ggplot2","title":"Visualization (plotting)","text":"‘long form’ stats can handy plotting ggplot. ensure long form, annex_stats_reshape() can called. already long format simply return , else reshaped wide format desired long format. Empirical CDF: stats contains series quantiles following naming scheme \"^p[0-9\\\\.]+$\" (e.g., p00, p02.5, …). code chunk subsets statistics get rows containing empirical quantiles, appends additional variable p numeric value percentile required demo plot following afterwards.","code":"stats <- annex_stats(annex_df) stats <- annex_stats_reshape(stats, format = \"long\") head(stats, n = 2) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 # Extracting rows with empirical quantiles tmp <- stats[grepl(\"^p[0-9\\\\.]+$\", stats$stats), ] # Extract numeric value for plotting tmp$p <- as.numeric(gsub(\"p\", \"\", tmp$stats)) # Unique ID as an interaction of study, home, room, month, and tod tmp$ID <- with(tmp, interaction(study, home, room, month, tod)) library(\"ggplot2\") ggplot(subset(tmp, variable == \"T\")) + geom_line(aes(x = p, y = value, col = home, group = ID)) + facet_wrap(~ room, scale = \"free\") + ggtitle(\"Empirical Cumulative Distribution Function of Temperature by Room Type\") ggplot(subset(tmp, variable == \"CO2\")) + geom_line(aes(x = p, y = value, col = interaction(month, tod, sep = \" - \"), group = ID)) + facet_wrap(~ room) + ggtitle(\"Empirical Cumulative Distribution Function of CO2 Concentration by Room Type\") ggplot(subset(tmp, variable == \"RH\")) + geom_line(aes(x = p, y = value, col = room, group = ID)) + facet_wrap(~ home) + ggtitle(\"Empirical Cumulative Distribution Function of Relative Humidity by Home\")"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Write and validate output","text":"article demonstrates write processed data (annex statistics) final pre-filled XLSX file validate file format. example based demo data set demo_UIBK.xlsx , details following code chunk please read article Prepare data XLSX.","code":"library(\"readxl\") # Reading measurement data raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") # Read and prepare config object config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Remove all rows process = FALSE # Prepare annex object library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") stats <- annex_stats(annex_df, format = \"long\") head(stats) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 ## 3 demo General AMB 2011 10 all RH quality_start 15248 ## 4 demo General AMB 2011 10 all RH quality_end 15253 ## 5 demo General AMB 2011 10 all RH interval_Min 300 ## 6 demo General AMB 2011 10 all RH interval_Q1 300"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"write","dir":"Articles","previous_headings":"","what":"Write annex statistics to file","title":"Write and validate output","text":"statistics calculated, data - returned annex_stats() - can written final ouput file. function annex_write_stats() create new XLSX file based annex template, store calculated statistics, pre-fill series META sheets take required meta information. information must added manually user.","code":"annex_write_stats(stats, file = \"final_UIBK.xlsx\", user = 1234) ## Get a copy of the template ## Starting to write final_UIBK.xlsx ## - Writing META-Study ## - Write 1 rows into 'META-Study' ## - Writing META-Home ## - Write 19 rows into 'META-Home' ## - Writing META-Room ## - Write 27 rows into 'META-Room' ## - Writing META-Variable ## - Write 80 rows into 'META-Variable' ## - Writing STAT ## - Saving file"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"where-to-get-a-user-id","dir":"Articles","previous_headings":"Write annex statistics to file","what":"Where to get a user ID?","title":"Write and validate output","text":"defined Annex 86 meetings contact Gabriel.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"meta","dir":"Articles","previous_headings":"","what":"Update meta information","title":"Write and validate output","text":"point, XLSX file final_UIBK.xlsx contain statistics, missing meta information. additional information needed, XLSX sheet contains placeholders like <....> (check META sheets) need updated user. columns/fields require meta information, others optional. optional meta information available, placeholders (<....>) can also deleted. annex_validate() inform user needs done: WARNING: Required meta information missing (either empty placeholder) NOTE: still contains placeholder. case simply replace placeholder correct meta information delete (optional information). time file can validated (see next section) see everything according requested standard information still missing invalid information entered.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"append-or-update-the-xlsx-file","dir":"Articles","previous_headings":"","what":"Append or update the XLSX file","title":"Write and validate output","text":"function write_annex_stats() argument mode defaults \"write\" provides two alternative modes: \"append\" \"update\". two modes allow write additional/updated statistics existing XLSX file preserve already added meta information (see section ). Append: Append new data existing file. function throw error new data overlaps existing one. Update: replace existing data STAT new data overlaps existing data XLSX file. Note mode = \"update\" overwrite existing data may result loss data potentially replaces existing records new partial data depending new object provided. Consider making backup XLSX file beforehand. WARNING: two modes \"append\" \"update\" early stage may unexpected outcomes. Feel free test modes report problems/issues. One known issue work properly XLSX file saved using libreoffice/openoffice using versino openxlsx prior version 4.2.5.9001. latest version (currently available via github April 21, 2023) resolves problem. details see (closed) issue #9.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"validate","dir":"Articles","previous_headings":"","what":"Validate final file","title":"Write and validate output","text":"function annex_validate() performs series checks original template (included package; always uses current version) well within XLSX file provided input. critical checks result exception (error; stops execution) well checks resulting notes user. notes tell ’s wrong missing allow user make appropriate changes, validating file . function returns TRUE FALSE (throw error), TRUE returned everything OK file required meta information entered properly. stage, file can used processing upload research repository (planned near future). case changes made file written annex_write_stats(). illegal changes made, critical errors detected. However, series messages printed inform everything filled properly. Simply open file spreadsheet editing software choice (MS Excel, Libreoffice, …), make required changes, save file, repeat validation annex_validate() happy returns TRUE.","code":"check <- annex_validate(\"final_UIBK.xlsx\", user = 1234) ## Checking columns in all sheets ## ## 'META-Study' ........ OK ## 'META-Home' ......... OK ## 'META-Room' ......... OK ## 'META-Variable' ..... OK ## 'Definitions' ....... OK ## Validating XLSX sheet STAT ## Everything OK (no warnings) ## Validating XLSX sheet META-Study ## ## WARNING: 'META-Study' column 'Contact' missing required info for ID: 1234-demo (row: 2) ## WARNING: 'META-Study' column 'Institution' missing required info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Year of first publication' provides no info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Publications' provides no info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Links' provides no info for ID: 1234-demo (row: 2) ## Validating XLSX sheet META-Home ## ## WARNING: 'META-Home' column 'Location: Country' missing required info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Location: City' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## WARNING: 'META-Home' column 'Ventilation type' missing required info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Comment Vent. Type' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Ventilation rate (entire home; [l/s])' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Method of vent. rate determination' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Comment vent. Rate determination' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightn. [xx]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightness ref press [Pa]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightness normalization value' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Type of building' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Size of home / TFA [m^2]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Type of Occupants' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Constr. type / building materials' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Energy standard' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Year of contruction / major renovation (four digit year)' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## WARNING: 'Location: Country' in 'META-Home' not in ISO3 standard, found: , , , , , , , , , , , , , , , , , , (rows: 2, 3, 4, 5, 6 and 14 more). ## See `?annex_countries` to get all allowed country abbrevations (ISO3166 alpha-3; ISO3). ## Validating XLSX sheet META-Room ## ## NOTE: 'META-Room' column 'Additionial room information (e.g., ceiling height, with atrium)' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Occupancy: Type' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Occupancy: Number' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Fresh air supply in measurement location' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Ventilation rate (room; [l/s])' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Method of vent. rate determination' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Comments' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## Everything OK (no warnings) ## Validating XLSX sheet META-Variable ## ## NOTE: 'META-Variable' column 'Variable additional information' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## NOTE: 'META-Variable' column 'Measurement device' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## NOTE: 'META-Variable' column 'Comments (e.g., sensor location)' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## Everything OK (no warnings) ##"},{"path":"https://some.example-url.com/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Reto Stauffer. Maintainer, author. Gabriel Rojas-Kopeinig. Funder, author. Tobias Grass. Author. Constanza Molina. Contributor. Fabián Sepúlveda. Contributor. Benjamin Jones. Contributor. James McGrath. Contributor. Francesco Babich. Contributor. Irene Lara Ibeas. Contributor. Akshit Gupta. Contributor. Marc Abadie. Contributor.","code":""},{"path":"https://some.example-url.com/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Stauffer R, Rojas-Kopeinig G, Grass T (2023). annex: IEA EBC Annex86 Data Analysis Package. R package version 0.2-9, https://github.com/IEA-EBC-Annex86/annex/.","code":"@Manual{, title = {annex: IEA EBC Annex86 Data Analysis Package}, author = {Reto Stauffer and Gabriel Rojas-Kopeinig and Tobias Grass}, year = {2023}, note = {R package version 0.2-9}, url = {https://github.com/IEA-EBC-Annex86/annex/}, }"},{"path":[]},{"path":"https://some.example-url.com/contact.html","id":"reporting-bugs","dir":"","previous_headings":"","what":"Reporting bugs","title":"Contact","text":"TODO(R): report bugs; publish package github use github issues? Mail?","code":""},{"path":[]},{"path":"https://some.example-url.com/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"IEA EBC Annex86 Data Analysis Package","text":"R package annex provides series functions methods easily process measurement data IEA EBC Annex86 project, well writing (validating) final file intended used build data repository research field related project. Install via remotes package currently hosted github can installed via remotes package calling remotes::install_github() within active R session. Note may need install remotes package first. Dependencies annex package available via repository dependencies required process data. R automatically resolve backwards dependencies installation. information, look DESCRIPTION file github.com.","code":"library('remotes') install_github(\"IEA-EBC-Annex86/annex\")"},{"path":"https://some.example-url.com/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"IEA EBC Annex86 Data Analysis Package","text":"figure shows schematic process use annex package process measurements well create validate final standardized output file. first, user needs import required data sets /. annex package provide functionality data come various different formats, however, documentation provides examples case data available XLSX format tabular text files (see Analysis XLSX Analysis textfiles), package limited . needed provide data proper R data.frames processing. function annex_prepare() helper function prepare measurement data set processing steps (can bypassed needed). annex() creator function annex objects. defines process performs series checks. annex_stats() takes annex object previous step calculate statistics (aggregated statistical mesures); returns annex_stats object. object previous step can written final XLSX file. result XLSX file containing statistics well pre-filled sheets required meta information. information filled manually user. annex_validate() can used check meta information filled properly manual interaction user required. validation happy XLSX file, analysis completed final analysis can e.g., submitted upcoming research repository used analysis.","code":""},{"path":"https://some.example-url.com/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"IEA EBC Annex86 Data Analysis Package","text":"Documentation examples available github.io https://iea-ebc-annex86.github.io/annex/ documentation contains series articles explain use annex package well additional information regarding package functionality.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":null,"dir":"Reference","previous_headings":"","what":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"List countries ISO-2 ISO-3 abbrevations. Used validate final XLSX file.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"Returns data.frame containing country name alongside ISO2 ISO3 short name (ISO 3116 alpha-2 alpha-3 standard).","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"IBAN (2023). COUNTRY CODES ALPHA-2 & ALPHA-3, https://www.iban.com/country-codes, accessed 2023-02-11.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Annex Creator Function — annex","title":"Annex Creator Function — annex","text":"Creates object class c(\"annex\", \"data.frame\") required calculate statistics.","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annex Creator Function — annex","text":"","code":"annex(formula, data, tz, meta = NULL, verbose = FALSE) # S3 method for annex head(x, ...) # S3 method for annex tail(x, ...) # S3 method for annex subset(x, ...) # S3 method for annex_stats head(x, ...) # S3 method for annex_stats tail(x, ...) # S3 method for annex_stats subset(x, ...)"},{"path":"https://some.example-url.com/reference/annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annex Creator Function — annex","text":"formula formula specify data set set . See 'Details' information. data data.frame containing obervations/data. tz character, time zone definition (e.g., \"Europe/Berlin\" \"UTC\"); required. OlsonNames() returns list possible time zones. correct time zone important properly calculate month time day. meta NULL (default) list information study, home, room (see 'Details'). verbose logical, defaults FALSE. Can set TRUE increase verbosity. x object class annex. ... arguments passed methods.","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Annex Creator Function — annex","text":"case data set provided data contain data one study, home, room, fomula two parts, looking e.g., follows: T + RH ~ datetime left hand side formula (left ~) specifies names variables observations processed, right hand side name variable containing time information (must class POSIXt). case, meta argument required provide information study, home, room. grouping information already data set, analysis can performed depending group information, typically: T + RH ~ datetime | study + home + room latter allows process observations different studies, homes, /rooms one go.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Annex Creator Function — annex","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annex Creator Function — annex","text":"","code":"# Create artificial data set for testing; typically this information is read # from a file or any other data connection. data <- data.frame(datetime = as.POSIXct(\"2022-01-01 00:00\", tz = \"Europe/Berlin\") + -10:10 * 3600, T = round(rnorm(21, mean = 20, sd = 2), 2), RH = round(runif(21, 40, 100), 2)) res1 <- annex(T + RH ~ datetime, data = data, meta = list(study = \"example\", home = \"ex\", room = \"BED\"), tz = \"Europe/Berlin\") head(res1, n = 3) #> datetime study room home year month tod T RH #> 1 2021-12-31 14:00:00 example BED ex 2021 12 07-23 21.90 94.09 #> 2 2021-12-31 15:00:00 example BED ex 2021 12 07-23 20.03 47.23 #> 3 2021-12-31 16:00:00 example BED ex 2021 12 07-23 19.99 72.39 # The meta information can also be added to `data` removing the need # to specify the `meta` argument and allows to mix data from different # studies and rooms. Appending study, room, and home to `data`: data <- transform(data, study = \"example\", home = \"ex\", room = \"BED\") head(data) #> datetime T RH study home room #> 1 2021-12-31 14:00:00 21.90 94.09 example ex BED #> 2 2021-12-31 15:00:00 20.03 47.23 example ex BED #> 3 2021-12-31 16:00:00 19.99 72.39 example ex BED #> 4 2021-12-31 17:00:00 19.63 54.65 example ex BED #> 5 2021-12-31 18:00:00 17.69 44.53 example ex BED #> 6 2021-12-31 19:00:00 21.12 98.15 example ex BED res2 <- annex(T + RH ~ datetime | study + home + room, data = data, tz = \"Europe/Berlin\") head(res2, n = 3) #> datetime study home room year month tod T RH #> 1 2021-12-31 14:00:00 example ex BED 2021 12 07-23 21.90 94.09 #> 2 2021-12-31 15:00:00 example ex BED 2021 12 07-23 20.03 47.23 #> 3 2021-12-31 16:00:00 example ex BED 2021 12 07-23 19.99 72.39"},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate year, month and time of day — annex_add_year_month_and_tod","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"Calculates year, month time day categories based input argument x respect time zone specified user.","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"","code":"annex_add_year_month_and_tod(x, tz)"},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"x object class POSIXt. tz time zone (character). Important properly calculate month time day.","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"List three elements year (integer), month (factor) tod (factor).","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"","code":"x <- as.POSIXct(\"2022-01-01\", tz = \"UTC\") + 0:10 * 3600 annex:::annex_add_year_month_and_tod(x, tz = \"Europe/Berlin\") #> $year #> [1] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 #> Levels: 2022 #> #> $month #> [1] 1 1 1 1 1 1 1 1 1 1 1 #> Levels: all 1 2 3 4 5 6 7 8 9 10 11 12 #> #> $tod #> [1] 23-07 23-07 23-07 23-07 23-07 23-07 07-23 07-23 07-23 07-23 07-23 #> Levels: 23-07 07-23 #> annex:::annex_add_year_month_and_tod(x, tz = \"US/Central\") #> $year #> [1] 2021 2021 2021 2021 2021 2021 2022 2022 2022 2022 2022 #> Levels: 2021 2022 #> #> $month #> [1] 12 12 12 12 12 12 1 1 1 1 1 #> Levels: all 1 2 3 4 5 6 7 8 9 10 11 12 #> #> $tod #> [1] 07-23 07-23 07-23 07-23 07-23 23-07 23-07 23-07 23-07 23-07 23-07 #> Levels: 23-07 07-23 #>"},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking Annex Config — annex_check_config","title":"Checking Annex Config — annex_check_config","text":"'annex config object' simple data.frame can created using Rs standard features. function checking content object matches requirements annex config object. check performed link{annex()} automatically, can also done user manually.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking Annex Config — annex_check_config","text":"","code":"annex_check_config(x)"},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking Annex Config — annex_check_config","text":"x object class data.frame checked.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking Annex Config — annex_check_config","text":"Invisibly returns (possibly modified) version x containing required columns specific order.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Checking Annex Config — annex_check_config","text":"function checks config object set properly contains required information preparing annex data. Throws errors : input data.frame variables missing ('column', 'variable', 'unit', 'study', 'home', 'room') configuration variable = \"datetime\" missing definition variables (datetime ) config contains missing values required variables column name variable = \"datetime\" missing variable 'column' unique duplicated entries combination variable/study/home/room (must unique) variables study, home room contain contain non-allowed characters. Must contain letters (lowercase uppercase), numbers, underscores. Must start letter.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking Annex Config — annex_check_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking Annex Stats to XML — annex_check_stats_object","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"Used checking/validating annex_stat objects; used internally annex_write_stats() ensure users (try ) store final XLSX files expected final output file.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"","code":"annex_check_stats_object(x)"},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"x object class annex_stat returned annex_stats().","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"return, throw error something match expected file format.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"following checked: Input correct type least one observation.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":null,"dir":"Reference","previous_headings":"","what":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Country codes (ISO 3166) alpha-2 alpha-3","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"","code":"annex_countries()"},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Returns data set ISO3166 shipped package (see ?ISO3166 details).","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Parsing Formula — annex_parse_formula","title":"Parsing Formula — annex_parse_formula","text":"Function used test parse formula used different functions annex package.","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parsing Formula — annex_parse_formula","text":"","code":"annex_parse_formula(f, verbose = FALSE)"},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parsing Formula — annex_parse_formula","text":"f object class Formula. verbose logical, defaults FALSE. Can set TRUE increase verbosity.","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parsing Formula — annex_parse_formula","text":"Returns list three components, namely vars (variables aggregate), time (name datetime variable) group (grouping variables).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Parsing Formula — annex_parse_formula","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parsing Formula — annex_parse_formula","text":"","code":"require(\"Formula\") #> Loading required package: Formula annex:::annex_parse_formula(Formula(T + RH ~ datetime | study + room + home)) #> $vars #> [1] \"T\" \"RH\" #> #> $time #> [1] \"datetime\" #> #> $group #> [1] \"study\" \"room\" \"home\" #>"},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare Annex Data — annex_prepare","title":"Prepare Annex Data — annex_prepare","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare Annex Data — annex_prepare","text":"","code":"annex_prepare(x, config, quiet = FALSE)"},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare Annex Data — annex_prepare","text":"x data.frame, data . config data.frame, config information (see annex_check_config()). quiet logical, default FALSE. set TRUE, messages warnings suppressed.","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Prepare Annex Data — annex_prepare","text":"Prepared data.frame processing annex package.","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Prepare Annex Data — annex_prepare","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":null,"dir":"Reference","previous_headings":"","what":"Room definition information — annex_room_definition","title":"Room definition information — annex_room_definition","text":"template contains series base abbrevations allowed define room alongside 'long name'. function returns definition data.frame.","code":""},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Room definition information — annex_room_definition","text":"","code":"annex_room_definition()"},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Room definition information — annex_room_definition","text":"data.frame base room abbrevation, long description, plus series examples valid room labels.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Room definition information — annex_room_definition","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate Statistics on Annex object — annex_stats","title":"Calculate Statistics on Annex object — annex_stats","text":"Calculate Statistics Annex object","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate Statistics on Annex object — annex_stats","text":"","code":"annex_stats(object, format = \"wide\", ..., probs = NULL)"},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate Statistics on Annex object — annex_stats","text":"object object class annex. format character, either \"wide\" (default) \"long\". ... currently unused. probs NULL (default; see Details) numeric vector probabilities values [0,1] (Values rounded closest 3 digits).","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate Statistics on Annex object — annex_stats","text":"Returns object class c(\"annex_stats\", \"data_frame\").","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Calculate Statistics on Annex object — annex_stats","text":"function allows return statistics wide format long format. can used calling annex_write_stats(), long/wide format can handy fur custom applications (e.g., plotting, ...). Argument probs forwarded stats::quantile() function. probs = NULL (default) empirical quantiles calculated 0 (minimum) 1 (maximum) interval 0.01 (one percent steps), including quantiles 0.005, 0.025, 0.975 0.995. Can specified differently user needed, however, longer yields standard statistics validation report problem.","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"statistics","dir":"Reference","previous_headings":"","what":"Statistics","title":"Calculate Statistics on Annex object — annex_stats","text":"Grouping: Statistics calculated different subsets (groups), typically study, home, room, year, month, tod (time day). However, set can vary depending users function call annex (see argument formula). annex_stats calculates series data/quality flags well statistical measures. Quality: quality_lower quality_upper contain fraction observations (percent) falling lower upper defined threshold (see annex_variable_definition). quality_start quality_end contain day (date ) first non-missing observation given current group; used estimate Nestim (see ). Interval: Time increments non-missing observations calculated seconds. interval_ columns show five digit summary plus arithmetic mean intervals. interval_Median used calculate estimate Nestim (see ). Nestim: Number estimated observations (see section ) N: Number non-missing observations NAs: Number missing observations (NA data set) Mean: $$\\bar{x} = \\frac{1}{N} \\sum_{= 1}^N x_i$$ (arithmetic mean) Sd: $$\\text{sd}(x) = \\sqrt{\\frac{1}{N - 1} \\sum_{= 1}^N \\big( (x_i - \\bar{x})^2\\big)}$$ p: Probabilites different quantiles. p00 represents overall minimum, p50 median, p100 overall maximum non-missing values. Uses empirical quantile function type = 7 (default; see quantile).","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"estimated-number-of-observations","dir":"Reference","previous_headings":"","what":"Estimated number of observations","title":"Calculate Statistics on Annex object — annex_stats","text":"value Nestim contains estimate number possible observations specific group. estimate based first/last date observation available (non-missing) well year, month, tod. Last least interval_Median used. example: Imagine statistics temperature observations one speicifc year month (monthly level aggregation) tod = \"07-23\". first non-missing value reported first day month, last one day 10. Given tod = \"07-23\" covers 16 hours, indicates observations available 16 hours 10 days = 160 hours total. Based best guess interval_median allows calculate Nestim. E.g., median interval 300 (300 seconds = 5 minutes) leas possible number observations Nestim = 10 days * 16 hours per day * 3600 seonds per hour / 300 seconds = 1920. Keep mind estimate best guess!","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate Statistics on Annex object — annex_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":null,"dir":"Reference","previous_headings":"","what":"Reshaping Annex Stats Objects — annex_stats_reshape","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Reshaping Annex Stats Objects","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"","code":"annex_stats_reshape(x, format = NULL)"},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"x object class annex_stats returned annex_stats(). format NULL default one \"long\" \"wide\" (see Details).","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Returns reshaped version input. Object provided x inherits annex_stats_wide (wide format) long format returned vice versa format = NULL. format specified either \"long\" \"wide\" long wide format returned (possibly unmodified version input input already desired format).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Copy of annex Output Template — annex_template","title":"Create Copy of annex Output Template — annex_template","text":"main aim annex package standardize data sets IEA EBC Annex86 project. create output file, annex_write_stats() uses template XLSX file (shipped package). function allows make local copy check format template needed.","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Copy of annex Output Template — annex_template","text":"","code":"annex_template(file, overwrite = FALSE)"},{"path":"https://some.example-url.com/reference/annex_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Copy of annex Output Template — annex_template","text":"file name file written, must end xlsx (case sensitive). overwrite logical, default FALSE. Can set TRUE overwrite existing file (aware loss data).","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create Copy of annex Output Template — annex_template","text":"return.","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create Copy of annex Output Template — annex_template","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate annex Output File — annex_validate","title":"Validate annex Output File — annex_validate","text":"Validate XLSX file created annex_write_stats(). Checks required sheets/columns available user-modified META information entered correctly.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate annex Output File — annex_validate","text":"","code":"annex_validate(file, user, quiet = FALSE, ...)"},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate annex Output File — annex_validate","text":"file name file validated (XLSX file). user positive integer, user identifier given project team. quiet logical, defaults FALSE. TRUE, output limited. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate annex Output File — annex_validate","text":"checks cause error stop execution. Others cause message information fixed make document valid. function stop due error return TRUE file validated proper, FALSE issues found.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Validate annex Output File — annex_validate","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":null,"dir":"Reference","previous_headings":"","what":"Variable definition information — annex_variable_definition","title":"Variable definition information — annex_variable_definition","text":"template contains definition allowed variables, also states whether additional information required (optional), upper lower bound considered 'valid' plus (specified) series allowed units. Used prepare data convert annex standard units, quality checks, well validation.","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Variable definition information — annex_variable_definition","text":"","code":"annex_variable_definition(as_list = FALSE)"},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Variable definition information — annex_variable_definition","text":"as_list logical. FALSE (default) data.frame returned, TRUE list (see Details).","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Variable definition information — annex_variable_definition","text":"Returns either data.frame list lists contains allowed (defined) variables.","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Variable definition information — annex_variable_definition","text":"as_list = TRUE list lists returned, else data.frame. List: name list corresponds name variable, whereas entry contains list logical flag additional information META sheet required well numeric lower upper bound defines range observation considered valid. Can NA specified (one ). allowed_units contains NA (unspecified) character wich one multiple comma separated units specifications. as_list = FALSE (default) information returned data.frame containing information.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Variable definition information — annex_variable_definition","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Writing Annex Stats to Disc — annex_write_stats","title":"Writing Annex Stats to Disc — annex_write_stats","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Writing Annex Stats to Disc — annex_write_stats","text":"","code":"annex_write_stats(x, file, user, mode = \"write\", ..., quiet = FALSE)"},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Writing Annex Stats to Disc — annex_write_stats","text":"x object class annex_stat returned annex_stats() (wide long format). file name (path) XLSX file store data. Must end xlsx (case sensitive). See 'Details'. user positive integer, user identifier given project team. appended data set. mode, character, writing mode. Can one \"write\" (default), \"append\" (add new data) \"update\" (update existing data). See 'Mode' information. ... yet used. quiet logical. set TRUE messages printed.","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Writing Annex Stats to Disc — annex_write_stats","text":"return, creates new XLSX file (see argument file) stores data, updates existing XLSX file (see argument section 'Writing mode').","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Writing Annex Stats to Disc — annex_write_stats","text":"function used write annex statistics - final output - XLSX file. output based template file shipped package predefined format. output file exist, template copied modified () saving data \"STAT\" sheet well pre-filling additional meta sheets manually edited/entered user. default, overwrite = FALSE. output file already exists, function terminated. However, can set TRUE allow annex_write_stats() manipulate/overwrite current data XLSX file. tries preserve custom data (TODO(R): yet implemented).","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"writing-mode","dir":"Reference","previous_headings":"","what":"Writing mode","title":"Writing Annex Stats to Disc — annex_write_stats","text":"three writing modes. Warning: Depending mode used, existing data can get lost (.e., removed). following modes available: write: Default mode, write data fresh XLSX file. assumed output file yet exist. exists error thrown unkown user like append new data existing file update (overwrite) data existing file. append: Append data existing XLSX file. mode expects file already exist correct format (check sheets columns template). file exist content file follow format template, error thrown. mode = \"append\" falls back mode = \"write\" output file yet exist. Else data x appended sheet 'STAT' additional entries 'META*' sheets created needed. case new object x contains data already STAT error thrown (new data appended must unique). update: Update data existing file. Warning: delete (drop) existing data sheet 'STAT' append new entries 'META*' sheets (delete existing entries). latter cause additional warnings validating file 'META*' entries longer needed (data deleted).","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Writing Annex Stats to Disc — annex_write_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking for Allowed Rooms — check_for_allowed_rooms","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"XLSX file template.xlsx contains series pre-defined names rooms (sheet 'Definitions'). function checks user defined room names valid. case sensitive; adjusted needed.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"","code":"check_for_allowed_rooms(x)"},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"x character vector room names.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"Character vector (possibly adjusted) room names, fails. case sensitive checking, return everything uppercase (toupper(x)).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking for Allowed Variables — check_for_allowed_variables","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"XLSX file template.xlsx contains series pre-defined names variables (sheet 'Definitions'). function checks user defined variable names valid. case sensitive; adjusted needed.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"","code":"check_for_allowed_variables(x)"},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"x character vector variable names.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"Character vector (possibly adjusted) variable names, fails.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set Bedroom — demo_Bedroom","title":"Demo data set Bedroom — demo_Bedroom","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing measurement data. data set demo_Bedroom_config contains corresponding configuration used calling annex_prepare().","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set Bedroom — demo_Bedroom","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Dummy text 4 — demo_Bedroom_config","title":"Dummy text 4 — demo_Bedroom_config","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing config demo_Bedroom data set, contains actual measurements.","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Dummy text 4 — demo_Bedroom_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set UIBK (XLSX) — demo_UIBK","title":"Demo data set UIBK (XLSX) — demo_UIBK","text":"One demo data sets used testing documentation/manuals. XLSX file containing , measurements well configuration prepare annex objects.","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set UIBK (XLSX) — demo_UIBK","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set UIBK config (textfile) — demo_UIBK_config","title":"Demo data set UIBK config (textfile) — demo_UIBK_config","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing config information measurement sheet demo_UIBK data set. alternative configuration contained dedicated sheet demo_UIBK data set.","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set UIBK config (textfile) — demo_UIBK_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Formats a data frame in specific format — formatting","title":"Formats a data frame in specific format — formatting","text":"Generates new data frame according formula provided.","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Formats a data frame in specific format — formatting","text":"","code":"formatting( data_frame, formula, tz = \"UTC\", format = \"%Y-%m-%d %H:%M:%S\", user = \"\", study = \"\", home = \"\", room = \"\" )"},{"path":"https://some.example-url.com/reference/formatting.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Formats a data frame in specific format — formatting","text":"data_frame data frame formula formula describing specific layout data frame tz time zone like \"UTC\", \"MET\", ... format format time stamps given data frame user abbreviation name respective scientist study natural number (entered character) home natural number (entered character) room abbreviation name respective room","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Formats a data frame in specific format — formatting","text":"Returns data frame specific format according formula provided","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Formats a data frame in specific format — formatting","text":"function adds columns referring specific season time day (tod) time stamp. Variables left side, date terms right including season tod well mandatory variables (home, room, etc.). additional variables given, can also found output. mandatory variable present output, message issued. Furthermore, evaluate function annex used unless required variables available. formula passed contains just mandatory variables, evaluate function annex can used without problems. output contains least seven columns addition columns respective variables.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get ID information — get_ID_info","title":"Get ID information — get_ID_info","text":"Used warning error messages. Returns printable string IDs identified.","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get ID information — get_ID_info","text":"","code":"get_ID_info(x, n = 5L, prefix = \" ID\")"},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get ID information — get_ID_info","text":"x character vector. n integer, defaults 5. Number rows explicitly listed (). prefix character NULL, default \"ID\".","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get ID information — get_ID_info","text":"Character string information suspicious values found XLSX file. suspicious rows, FALSE returned.","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get ID information — get_ID_info","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":null,"dir":"Reference","previous_headings":"","what":"Get required columns for warnings and infos — get_required_columns","title":"Get required columns for warnings and infos — get_required_columns","text":"Different sheets contain different columns require user specify meta information details (empty cells allowed). function returns names columns (XLSX file) used validation. definition available, NULL returned.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get required columns for warnings and infos — get_required_columns","text":"","code":"get_required_columns(sheet)"},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get required columns for warnings and infos — get_required_columns","text":"sheet character, name XLSX sheet.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get required columns for warnings and infos — get_required_columns","text":"Returns NULL definition/required columns, character vector exact column name used XLSX.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get required columns for warnings and infos — get_required_columns","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get row information — get_row_info","title":"Get row information — get_row_info","text":"Used warning error messages. Returns printable string information find missing, invalid, ... values XLSX file.","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get row information — get_row_info","text":"","code":"get_row_info(x, n = 5L, offset = 1L, prefix = \" Row\")"},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get row information — get_row_info","text":"x integer logical, see 'Details'. n integer, defaults 5. Number rows explicitly listed (). offset integer, number additional header lines XLSX sheet correct row indicator (defaults 1). prefix character NULL, default \" Row\".","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get row information — get_row_info","text":"Character string information suspicious values found XLSX file. suspicious rows, FALSE returned.","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get row information — get_row_info","text":"input class integer assumed values correspond observations data.frame. .e, 1 first observation data.frame. input logical vector assumed entries TRUE suspicious, order corresponds observations data.frame. return value point suspicous rows context XLSX file typically one additional header line (thus default offset = 1L).","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get row information — get_row_info","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Regularity of an Annex Series — is.regular.annex","title":"Check Regularity of an Annex Series — is.regular.annex","text":".regular regular function checking whether series observations underlying regularity even strictly regular. Evaulate group annex object.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Regularity of an Annex Series — is.regular.annex","text":"","code":"# S3 method for annex is.regular(x, strict = TRUE, ...)"},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Regularity of an Annex Series — is.regular.annex","text":"x object class annex. strict logical, defaults TRUE. FALSE, regularity (strict regularity) checked. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Regularity of an Annex Series — is.regular.annex","text":"Returns named logical vector name combination grouping (study, home, room), content result checking regularity.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check Regularity of an Annex Series — is.regular.annex","text":"Reto stauffer","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard plot for annex objects — plot.annex","title":"Standard plot for annex objects — plot.annex","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard plot for annex objects — plot.annex","text":"","code":"# S3 method for annex plot(x, bygroup = FALSE, start = NULL, end = NULL, ...)"},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard plot for annex objects — plot.annex","text":"x object class annex. bygroup logical, default subplots build different variables. TRUE, varables one group plotted one subplot. start start time period interest. end end time period interest. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard plot for annex objects — plot.annex","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard plot for annex_stats objects — plot.annex_stats","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"TODO(R): can one plot 5d object?","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"","code":"# S3 method for annex_stats plot(x, ...)"},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"x object class annex. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Annex Summary — summary.annex","title":"Annex Summary — summary.annex","text":"Numeric summary annex object.","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annex Summary — summary.annex","text":"","code":"# S3 method for annex summary(object, type = \"default\", ...)"},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annex Summary — summary.annex","text":"object object class annex. type character, one \"default\" (default) \"statistic\". type = \"statistics\" result annex_stats(object) printed. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Annex Summary — summary.annex","text":"Returns NULL (invisible).","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Annex Summary — summary.annex","text":"Reto stauffer","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-9","dir":"Changelog","previous_headings":"","what":"annex 0.2-9","title":"annex 0.2-9","text":"Added additional check annex_prepare() ensure data columns numeric. one variables provided numeric contains missing values (e.g., logical NAs) column converted automatically (NA_real_). Else (numeric missing) error thrown.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-8","dir":"Changelog","previous_headings":"","what":"annex 0.2-8","title":"annex 0.2-8","text":"Added additional ventilation type definitions (Exhaust air)","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-7","dir":"Changelog","previous_headings":"","what":"annex 0.2-7","title":"annex 0.2-7","text":"Fixed serious issue intervals (often measurements reported) also affects estimate many observations estimate (think ). Added new variable Flow (air flow) ’s conversions; defaults l/s (liters per second) allowing values (via annex config) m3/h (quibic meters per hour) cfm (suare feet per minute).","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-6","dir":"Changelog","previous_headings":"","what":"annex 0.2-6","title":"annex 0.2-6","text":"issue openxlsx fixed, using openxlsx >= 4.2.5.9001 annex shoul work expected using MS Excel. mean time one small issue openxlsx adressed (opening/modifying .xlsx files openoffice). See issue 9 details. Modified variable definition. Minor renaming, modified/added lower upper bounds well allowed units. addition … … series unit conversion functions added. Updated vignettes (documentation) new code base. Updated extended tinytests new release; mainly unit conversions.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-4","dir":"Changelog","previous_headings":"","what":"annex 0.2-4","title":"annex 0.2-4","text":"Release candidate testing February 2023 major changes based discussions meeting early February. config object now must contain “unit” variable. allowed variables (see annex_variable_definition()) set pre-defined units must used. annex_prepare() internally converts data ‘annex standard units’. E.g., user can provide temperature data Kelvin Farenheit, annex_prepare() always convert degrees Celsius. currently implemented “T” (temperature; deg C), “RH” (relative humidity; percent) “Pressure” (hPa). Auto-fill “META-Variable” variables annex package enforces unit (e.g., “T” always degrees Celsius; “RH” always percent). Removed “META-Season” sheet XLSX file. Changed aggregation. Originally aggregation done quarterly level including years. new version aggregates year + month. Allowing rooms numbered differenciation adding two digits. E.g. BED, BED1, BED2, BED66 (room types). New functions annex_variable_definition() annex_room_definition() return information allowed variables/room labels amongst information. Added data set containing ISO3166 alpha-3 (ISO3) country codes used validationn. Convenience function annex_countries() returns data(\"ISO3166\") Added quality flag stats; percentage observations falling certain threshold exceed threshold. bounds defined “Definitions” sheet XLSX file can accessed calling annex_variable_definition(). Additional output validating XLSX file; improved readability. Added interval (measurement interval) information stats; time seconds previous observation recorded data set. Calculated varaible level; value present (missing value) considered ‘mesured’ leads longer interval times. Currently reporting five number summary plus XLSX sheets ‘META-Room’ ‘META-Variable’ column optional information measurement location (e.g., next window, center room, important/helpful information) variable (optional meta data). Additional tinytests support functions. Validation: Decent update validation show granular errors warnings. Additional checks specific varaibles ensure content follows expected format. Added conditional tests variables (require additional information).","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-0","dir":"Changelog","previous_headings":"","what":"annex 0.2-0","title":"annex 0.2-0","text":"development since January 2, 2023; intended next release initial testing phase December 2022 February 2023. Renaming ‘Pollutant’ consistently ‘Variable’ (issue #2) Renaming sheet ‘Meta-Period’ ‘Meta Season’ (issue #2) Automatically filling ‘Measurement Location’ META-Room (issue #3) Automatically filling ‘Variable Name’ META-Variable (issue #4) Adjusting (internal) function names (Pollutants -> Variables; Period -> Season) given adjustments updates listed .","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-01","dir":"Changelog","previous_headings":"","what":"annex 0.1","title":"annex 0.1","text":"Summary major fixes features development package 0.1-X state. New infrastructure custom S3 class series handy methods Introducing config object easy control Moving project https://github.com/IEA-EBC-Annex86/annex/ Adding first version annex_write_stats(); overwrite mode now Added method reshape annex_stats objects long wirde form vice versa annex_write_stats now accepts long wide formats Added logo (draft) Added annex_validate validate XLSX output file; likely missing checks. Resolving series notes/warnings build check Properly adding licenses (GPL-2 + GPL-3) Updating documentation readme; adding process schematic. Removing unused R scripts (version 0 annex package). Removing rows STAT writing file N == NAs; data available . Rounding stats 4 digits max. Adjusting documentation according GR (0.0-14) Added list contributors; added ORCID GR.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-00-9000","dir":"Changelog","previous_headings":"","what":"Annex 0.0-9000","title":"Annex 0.0-9000","text":"Reto just playing around.","code":""}] +[{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Calculate statistics","text":"data prepared, analysis can performed. article continues example used article Prepare data XLSX works way examples included documentation, e.g., Prepare data textfiles. Please look article information following lines code /get \"demo_UIBK.xlsx\" file follow article.","code":"library(\"readxl\") # Importing data and config object (meta information) raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Custom subsetting # Prepare data for annex() library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df, n = 3) ## datetime study home room RH SolRad T CO2 Other ## 1 2011-10-01 00:05:00 demo General AMB 88.4 3 13.35 NA NA ## 2 2011-10-01 00:10:00 demo General AMB 88.9 3 13.25 NA NA ## 3 2011-10-01 00:15:00 demo General AMB 89.2 3 13.17 NA NA"},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"performing-the-analysis","dir":"Articles","previous_headings":"","what":"Performing the analysis","title":"Calculate statistics","text":"data set prepared properly (note annex_prepare() convenience function, can also done manually) final object can prepared.","code":""},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"prepare-annex-object","dir":"Articles","previous_headings":"Performing the analysis","what":"Prepare annex object","title":"Calculate statistics","text":"annex() creator function creates object class annex (S3) providing series methods functions conduct final analysis. information object orientation system S3 can found e.g. function expects formula input describes process data. three parts formula : ~ | first part defines variables (measurements) processed Part two always ~ datetime; date time information statistics Part three grouping, typically study + home + room series S3 methods exist annex objects might extended future. summary() head()/tail() .regular() plot()","code":"annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") head(annex_df) ## datetime study home room year month tod RH T CO2 ## 1 2011-10-01 00:05:00 demo General AMB 2011 10 23-07 88.4 13.35 NA ## 2 2011-10-01 00:10:00 demo General AMB 2011 10 23-07 88.9 13.25 NA ## 3 2011-10-01 00:15:00 demo General AMB 2011 10 23-07 89.2 13.17 NA ## 4 2011-10-01 00:20:00 demo General AMB 2011 10 23-07 90.2 13.00 NA ## 5 2011-10-01 00:25:00 demo General AMB 2011 10 23-07 90.9 12.86 NA ## 6 2011-10-01 00:30:00 demo General AMB 2011 10 23-07 90.7 12.80 NA class(annex_df) ## [1] \"annex\" \"data.frame\""},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"calculating-statistics","dir":"Articles","previous_headings":"Performing the analysis","what":"Calculating statistics","title":"Calculate statistics","text":"Based object returned annex() analysis can performed calling annex_stats(). function aggregates data based formula provided , calculates series statistical properties, returns object class annex_stats. default, argument format set \"wide\" return statistics wide format, .e. calculated values columns format = \"long\" create one line every calculated value. chosen format (long wide) matter analysis particular format may convenient processed manually.","code":"head(annex_df) ## datetime study home room year month tod RH T CO2 ## 1 2011-10-01 00:05:00 demo General AMB 2011 10 23-07 88.4 13.35 NA ## 2 2011-10-01 00:10:00 demo General AMB 2011 10 23-07 88.9 13.25 NA ## 3 2011-10-01 00:15:00 demo General AMB 2011 10 23-07 89.2 13.17 NA ## 4 2011-10-01 00:20:00 demo General AMB 2011 10 23-07 90.2 13.00 NA ## 5 2011-10-01 00:25:00 demo General AMB 2011 10 23-07 90.9 12.86 NA ## 6 2011-10-01 00:30:00 demo General AMB 2011 10 23-07 90.7 12.80 NA stats <- annex_stats(annex_df, format = \"long\") head(stats) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 ## 3 demo General AMB 2011 10 all RH quality_start 15248 ## 4 demo General AMB 2011 10 all RH quality_end 15253 ## 5 demo General AMB 2011 10 all RH interval_Min 300 ## 6 demo General AMB 2011 10 all RH interval_Q1 300"},{"path":"https://some.example-url.com/articles/calculate_stats.html","id":"next-steps","dir":"Articles","previous_headings":"Performing the analysis","what":"Next steps","title":"Calculate statistics","text":"calculating statistics, following steps can performed: Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Config file/objects","text":"make pre-processing data analysis user-friendly easier automatize, annex package provides configuration feature. Technically just regular data.frame used lookup table bring data expected format can come source (e.g., text file, XLSX file, created via script, …).","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"configuration-content-and-purpose","dir":"Articles","previous_headings":"","what":"Configuration content and purpose","title":"Config file/objects","text":"following output shows first n = 6 lines configuration object used article Prepare data textfiles; first six lines data.frame \\(6\\) variables (columns). used tell annex package information needs processed, find important information, translate (rename) variables meet annex standard format.","code":"head(config, n = 6) ## column variable study unit home room ## 1 X datetime ## 2 co2 CO2 DEMO_STUD ppm Casa_Blanca Bed1 ## 3 humidity rH DEMO_STUD % Casa_Blanca Bed1 ## 4 pressure Pressure DEMO_STUD hPa Casa_Blanca Bed1 ## 5 temp T DEMO_STUD C Casa_Blanca Bed1 ## 6 voc VOC DEMO_STUD ug/m3 Casa_Blanca Bed1"},{"path":"https://some.example-url.com/articles/config.html","id":"the-six-required-columns","dir":"Articles","previous_headings":"Configuration content and purpose","what":"The six required columns","title":"Config file/objects","text":"column: name column imported data set (e.g., XLSX file text file). variable: Defines new variable name; one different variables (parameters) expected annex package (see Variable definition). study: Name study data belong . home: Name home (building) data belong . room: Abbreviation type room data belong (see Room definition). unit: Units input data (raw data); annex_prepare() automatically convert ’annex standard units (see Variable definition). column, study home can chosen freely user, series pre-defined values available variable (plus unit) room (case sensitive). See Lookup functions get full list defined values.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"the-required-rows","dir":"Articles","previous_headings":"Configuration content and purpose","what":"The required rows","title":"Config file/objects","text":"one required row must exist one defines date time information can found. row defines variable \"datetime\" located imported data set (case variable called \"X\"). rows specify column imported data set contains information processed. Variables listed configuration (available imported data set) ignored processing steps (namely calling annex_prepare()).","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"purpose","dir":"Articles","previous_headings":"Configuration content and purpose","what":"Purpose","title":"Config file/objects","text":"purpose object prepare imported data set object expected annex package analysis saving data later use. used define required information stored used lookup table (translation table) prepare/rename variables, format data according annex standard format used processing steps.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"readimport-configuration","dir":"Articles","previous_headings":"","what":"Read/import configuration","title":"Config file/objects","text":"two articles Prepare data XLSX Prepare data textfiles show examples import (read) configuration XLSX file text file. file can imported data.frame via R can used.","code":""},{"path":"https://some.example-url.com/articles/config.html","id":"technical-note","dir":"Articles","previous_headings":"","what":"Technical note","title":"Config file/objects","text":"Note configuration convenience feature. Technically can bypassed preparing data set outside annex starting analysis.","code":""},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare data from textfiles","text":"article explains import process data annex package require data available tabular text files (CSV). demonstrate , two files used called demo_Bedroom.txt (contains measurement data) well demo_Bedroom_config.TXT (contains configuration; see article Config file). files can easily read using base R functions, namely read.table() interfacing functions like read.csv(), utils::read.delim() etc. (see ?read.table details).","code":""},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"reading-the-data","dir":"Articles","previous_headings":"","what":"Reading the data","title":"Prepare data from textfiles","text":"first step import () measurement data (stored raw_df) (ii) configuration (stored config): objects class data.frame (tibble data frames precise) dimension \\(51890 \\times 8\\) (raw_df) \\(7 \\times 6\\) (config) respectively. first observations (rows) two objects look follows: object raw_df contains variables (columns) named “X”, “radonShortTermAvg”, “temp”, “humidity” original names XLSX sheet, config object contains definition columns raw_df contains belong . details read article Config file.","code":"raw_df <- read.csv(\"demo_Bedroom.txt\") config <- read.table(\"demo_Bedroom_config.TXT\", comment.char = \"#\", sep = \"\", header = TRUE, na.strings = c(\"NA\", \"empty\")) # see ?read.table for details # Class and dimension of the objects c(\"raw_df\" = is.data.frame(raw_df), \"config\" = is.data.frame(config)) ## raw_df config ## TRUE TRUE cbind(\"raw_df\" = dim(raw_df), \"config\" = dim(config)) ## raw_df config ## [1,] 51890 7 ## [2,] 8 6 head(raw_df[, 1:4], n = 3) # First three columns only ## X radonShortTermAvg temp humidity ## 1 2011-01-01 00:01:26 151 18.8 51 ## 2 2011-01-01 00:06:25 151 18.8 51 ## 3 2011-01-01 00:11:25 151 18.8 51 head(config, n = 3) ## column variable study unit home room ## 1 X datetime ## 2 co2 CO2 DEMO_STUD ppm Casa_Blanca Bed1 ## 3 humidity rH DEMO_STUD % Casa_Blanca Bed1"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"checking-the-config-object","dir":"Articles","previous_headings":"Reading the data","what":"Checking the config object","title":"Prepare data from textfiles","text":"check whether config object expected annex package, function annex_check_config() can used. case problems detected, error thrown (see Config file). Else, function silent example: … errors, config object meets annex requirements. Note step necessary performed automatically calling annex_prepare() can handy development.","code":"library(\"annex\") annex_check_config(config)"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"preparing-data","dir":"Articles","previous_headings":"","what":"Preparing data","title":"Prepare data from textfiles","text":"raw_df contains raw data set, config object contains information rename columns observations belong . prepare_annex() helper function prepare data set steps. moment get error variable containing date time information proper datetime object (object class POSIXt) character. information comes proper ISO format, simply convert column (column X raw_df) call annex_prepare() . annex_prepare() performs series tasks: Checking config object (calls annex_check_config() internally). config object valid, variables (columns) raw_df renamed checked correct class, informs user columns raw_df included config (just note) additional columns defined config occur raw_df, returns modified (possibly subsetted) object, ensures datetime proper datetime object (POSIXt). checks missing/additional definitions config intended inform user possible misspecifications result error.","code":"prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) ## [1] \"datetime\" \"study\" \"home\" \"room\" \"CO2\" \"Pressure\" ## [7] \"Radon\" \"RH\" \"T\" \"VOC\" ## Error in annex_prepare(raw_df, config, quiet = TRUE): variable `datetime` (originally column `X`) must be of class POSIXt # see ?as.POSIXct for details and options raw_df <- transform(raw_df, X = as.POSIXct(X, tz = \"UTC\")) class(raw_df$X) ## [1] \"POSIXct\" \"POSIXt\" prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df) ## datetime study home room CO2 Pressure Radon RH T VOC ## 1 2011-01-01 00:01:26 DEMO_STUD Casa_Blanca BED1 470 1026.5 151 51 18.8 136 ## 2 2011-01-01 00:06:25 DEMO_STUD Casa_Blanca BED1 477 1026.5 151 51 18.8 142 ## 3 2011-01-01 00:11:25 DEMO_STUD Casa_Blanca BED1 483 1026.5 151 51 18.8 131 ## 4 2011-01-01 00:16:25 DEMO_STUD Casa_Blanca BED1 477 1026.5 151 51 18.8 140 ## 5 2011-01-01 00:21:25 DEMO_STUD Casa_Blanca BED1 481 1026.4 151 51 18.8 135 ## 6 2011-01-01 00:26:25 DEMO_STUD Casa_Blanca BED1 483 1026.4 168 51 18.7 131"},{"path":"https://some.example-url.com/articles/from_textfiles.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare data from textfiles","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare data from XLSX","text":"article explains import process data annex package required data available XLSX format. purpose, demo data set called demo_UIBK.xlsx used (shipped package) contains two sheets: measurements: data (e.g., logger pre-processed) annex_configuration: Configuration (see article Config file) Save demo file /xlsx data file R working directory. Importing data R user, annex package provide import functionality. XLSX files multitude R packages exist; article making use readxl package, however, package allows read data XLSX files return object class data.frame work well.","code":""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"reading-the-data","dir":"Articles","previous_headings":"","what":"Reading the data","title":"Prepare data from XLSX","text":"first step import () measurement data (stored raw_df) (ii) configuration (stored config): objects class data.frame (tibble data frames precise) dimension \\(1500 \\times 106\\) (raw_df) \\(106 \\times 7\\) (config) respectively. first observations (rows) two objects look follows: object raw_df contains variables (columns) named “Zeitraum ab”, “T-WZ_W1 [°C] avg”, “rH-WZ_W1 [% rH] avg” original names XLSX sheet, config object contains definition columns raw_df contains belong . details read article Config file. variable config$process custom column containing logical value whether column used processing. like process rows config$proces == TRUE. config pure data.frame, subsetting can used.","code":"library(\"readxl\") raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") # Class and dimension of the objects c(\"raw_df\" = is.data.frame(raw_df), \"config\" = is.data.frame(config)) ## raw_df config ## TRUE TRUE cbind(\"raw_df\" = dim(raw_df), \"config\" = dim(config)) ## raw_df config ## [1,] 1500 106 ## [2,] 106 7 head(raw_df[, 1:3], n = 3) # First three columns only ## # A tibble: 3 × 3 ## `Zeitraum ab` `T-WZ_W1 [°C] avg` `rH-WZ_W1 [% rH] avg` ## ## 1 2011-10-01 00:05:00 22.6 55.6 ## 2 2011-10-01 00:10:00 22.6 55.5 ## 3 2011-10-01 00:15:00 22.6 55.4 head(config, n = 3) ## # A tibble: 3 × 7 ## process column variable unit study home room ## ## 1 1 Zeitraum ab datetime NA NA NA NA ## 2 1 T-WZ_W1 [°C] avg T C demo W1 LIV ## 3 1 rH-WZ_W1 [% rH] avg rH % demo W1 LIV config <- subset(config, process == TRUE) # Remove all rows process = FALSE"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"checking-the-config-object","dir":"Articles","previous_headings":"Reading the data","what":"Checking the config object","title":"Prepare data from XLSX","text":"check whether config object expected annex package, function annex_check_config() can used. case problems detected, error thrown (see Config file). Else, function silent example: … errors, config object meets annex requirements. Note step necessary performed automatically calling annex_prepare() can handy development.","code":"library(\"annex\") annex_check_config(config)"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"preparing-data","dir":"Articles","previous_headings":"","what":"Preparing data","title":"Prepare data from XLSX","text":"Based raw_df still contains raw data set read XLSX file config object information renaming (columns used), data set processing can created. annex_prepare() performs series tasks: Checking config object (calls annex_check_config() internally). config object valid, variables (columns) raw_df renamed checked correct class, informs user columns raw_df included config (just note) additional columns defined config occur raw_df, returns modified (possibly subsetted) object, ensures datetime proper datetime object (POSIXt). checks missing/additional definitions config intended inform user possible misspecifications result error.","code":"prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) head(prepared_df) ## datetime study home room RH SolRad T CO2 Other ## 1 2011-10-01 00:05:00 demo General AMB 88.4 3 13.35 NA NA ## 2 2011-10-01 00:10:00 demo General AMB 88.9 3 13.25 NA NA ## 3 2011-10-01 00:15:00 demo General AMB 89.2 3 13.17 NA NA ## 4 2011-10-01 00:20:00 demo General AMB 90.2 3 13.00 NA NA ## 5 2011-10-01 00:25:00 demo General AMB 90.9 3 12.86 NA NA ## 6 2011-10-01 00:30:00 demo General AMB 90.7 3 12.80 NA NA"},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"ensure-correct-date-and-time-timezone","dir":"Articles","previous_headings":"","what":"Ensure correct date and time (timezone)","title":"Prepare data from XLSX","text":"Note: read_excel() (readxl) package may automartically detect convert date time information POSIXct (date time object), however, Excel notion timezones, information returned always UTC! Investigate class time zone attribute attached: enforce different time zone (assuming data recorded time zone different UTC) one need acoerce information back character without time zone information (using format()) back POSIXct allows set correct time zone. demonstration (show command) convert information ‘US/Central’ back ‘UTC’. time zone conversion can also done raw_df object (needed) needs addressed calling annex() (see Calculating statistics (analysis)) ensure information processed properly.","code":"class(prepared_df$datetime) # Class of our first variable (Zeitraum ab) ## [1] \"POSIXct\" \"POSIXt\" attr(prepared_df$datetime, \"tzone\") # Time zone used ## [1] \"UTC\" head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 UTC\" \"2011-10-01 00:10:00 UTC\" # Coerce to 'US/Central' prepared_df$datetime <- as.POSIXct(format(prepared_df$datetime), tz = \"US/Central\") head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 CDT\" \"2011-10-01 00:10:00 CDT\" attr(prepared_df$datetime, \"tzone\") ## [1] \"US/Central\" # Coerce back to 'UTC' prepared_df$datetime <- as.POSIXct(format(prepared_df$datetime), tz = \"UTC\") head(prepared_df$datetime, n = 2) # First three entries ## [1] \"2011-10-01 00:05:00 UTC\" \"2011-10-01 00:10:00 UTC\" attr(prepared_df$datetime, \"tzone\") ## [1] \"UTC\""},{"path":"https://some.example-url.com/articles/from_xlsx.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare data from XLSX","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Lookup functions/definitions","text":"package using series ‘lookup tables’ data sets validate correctness data. includes testing config object correct format validate XLSX file. case problems found, error messages, warnings, notes include hints going wrong. series small helper functions exist allow user get definitions used internally kind tests.","code":""},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"variable-definition","dir":"Articles","previous_headings":"","what":"Variable definition","title":"Lookup functions/definitions","text":"annex_variable_definition() returns data.frame (list) containing names allowed variables well additional information. name: Name variable (used column variable config object) required: Whether additional variable information required (used annex_validate()) lower: Lower bound; observations threshold considered bad quality. Used calculate quality_lower annex_stats(). NA bound defined. upper: Upper bound; observations threshold considered bad quality. Used calculate quality_upper annex_stats(). NA bound defined. allowed_units: Comma separated list allowed units needed config object NA defined. set, first entry ‘annex standard unit’ (see also Unit conversion). table shows table web-table form:","code":"require(\"annex\") ## Loading required package: annex var_def <- annex_variable_definition() head(var_def, n = 3) ## name required lower upper allowed_units ## 1 CO2 FALSE 350 10000 ppm, % ## 2 CO FALSE 0 100 ug/m3, mg/m3, ppm, ppb ## 3 HCHO FALSE 0 1000 ug/m3, mg/m3, ppm, ppb"},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"room-definition","dir":"Articles","previous_headings":"","what":"Room definition","title":"Lookup functions/definitions","text":"annex_room_definition() returns data.frame containing names allowed room definitions. allowed room type base name (e.g., \"BED\"; Bedroom) can extended adding two numeric digits. allows define multiple bedrooms needed (see examples_valid_labels included ). labels used config object. name: Base name/base abbreviation available room types. long_name: Human readable description. examples_valid_labels: Examples allowed names label multiple rooms type within one home. table shows full list web-table form:","code":"require(\"annex\") room_def <- annex_room_definition() head(room_def, n = 3) ## name long_name examples_valid_labels ## 1 AMB Ambient AMB, AMB1, AMB2, AMB25 ## 2 BED Bedroom BED, BED1, BED2, BED25 ## 3 LIV Living room LIV, LIV1, LIV2, LIV25"},{"path":"https://some.example-url.com/articles/lookupfunctions.html","id":"iso3-country-code","dir":"Articles","previous_headings":"","what":"ISO3 country code","title":"Lookup functions/definitions","text":"output XLSX file (sheet “META-home”) user needs specify country (location) ‘home’ using ISO3 (ISO3166 alpha-3) country codes. list available country codes shipped annex package can accessed using annex_countries(). information used validating output XLSX (see Write validate). table shows 249 defined countries; searchable table.","code":"require(\"annex\") iso3_def <- annex_countries() head(iso3_def, n = 3) ## country ISO2 ISO3 ## 1 Afghanistan AF AFG ## 2 Åland Islands AX ALA ## 3 Albania AL ALB"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Prepare with time zones & units","text":"article shows import prepare data set calculate annex statistics, focusing following two aspects: Time zone: deal time zones Unit conversion: Automatically convert units observations. demonstration file called demo_US.xlsx used already contains two sheets, one contains simulated observations, one containing configuration (meta info) allows translate data ‘observations sheet’ object required annex(). Please also look two articles Prepare data XLSX Prepare data textfiles examples.","code":""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"scenario-1","dir":"Articles","previous_headings":"","what":"Scenario (1)","title":"Prepare with time zones & units","text":"Imagine got observations logger recording date time “US/Central” (CST) time contains data four different sensors: Kitchen room temperature (indoor); Fahrenheit Kitchen relative humidity (indoor); unit (0.0 1.0) exhaust temperature (heating system); degrees Celsius Ambient air pressure; mmHg (millimetre mercury)","code":""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"reading-the-data","dir":"Articles","previous_headings":"Scenario (1)","what":"Reading the data","title":"Prepare with time zones & units","text":"Step one import data; using readxl package : quick look first \\(3\\) observations (rows) object raw_df shows got variable loggertime seems contain date time observation US format (mm/dd/yyyy HH:MM:SS) know represents date time “US/Central” time. However, looking class variable raw_df$loggertime can see class character (chr; text) wherefore need properly convert making use . addition, simulated data set contains periods missing data well periods single sensors report data shown later.","code":"library(\"readxl\") excel_sheets(\"demo_US.xlsx\") # Checking sheet names ## [1] \"meta_config\" \"airquality_data\" # Reading observations raw_df <- read_excel(\"demo_US.xlsx\", sheet = \"airquality_data\") raw_df <- as.data.frame(raw_df) # Convert to simple data.frame # Reading configuration config <- read_excel(\"demo_US.xlsx\", sheet = \"meta_config\") config <- as.data.frame(config) # Convert to simple data.frame head(raw_df, n = 3) ## loggertime temperature.kitchen rel.hum.kitchen ## 1 12/28/2028 06:30:00 72.01654 0.89 ## 2 12/28/2028 06:40:00 72.31357 0.96 ## 3 12/28/2028 06:50:00 72.49413 0.75 ## exhaust.temperature..Cels. air.pressure ## 1 47.24872 675.4629 ## 2 46.95983 676.5550 ## 3 46.62533 676.1809 class(raw_df$loggertime) ## [1] \"character\""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"convert-loggertime","dir":"Articles","previous_headings":"Scenario (1)","what":"Convert loggertime","title":"Prepare with time zones & units","text":"convert date time information proper datetime object (object class POSIXct) including proper time zone, can call .POSIXct(). Arguments: x: character vector raw_df$loggertime right now object. format: format date time information (see ?strftime get list available options). tz: Time zone definition. Can long format (e.g., \"US/Central\") short (e.g., \"CST\"). Call OlsonNames() get list time zones (long format). step important ensure annex() later knows interpret date time information aggregation. Note time zone raw data time zone calculating statistics can different.","code":"# Convert and overwrite existing column raw_df$loggertime <- as.POSIXct(x = raw_df$loggertime, format = \"%m/%d/%Y %H:%M:%S\", tz = \"US/Central\") # Checking the variable head(raw_df$loggertime) ## [1] \"2028-12-28 06:30:00 CST\" \"2028-12-28 06:40:00 CST\" ## [3] \"2028-12-28 06:50:00 CST\" \"2028-12-28 07:00:00 CST\" ## [5] \"2028-12-28 07:10:00 CST\" \"2028-12-28 07:20:00 CST\" attr(raw_df$loggertime, \"tz\") # Shows time zone abbreviation ## [1] \"US/Central\""},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"the-config-object","dir":"Articles","previous_headings":"Scenario (1)","what":"The config object","title":"Prepare with time zones & units","text":"Next, let us look config object. described detail Config file/objects object contains information interpret raw data set. shown, unit column defines one temperature recorded Fahrenheit (unit = \"F\"), relative humidity without unit (unit = \"-\"), air pressure millimeter mercury (unit = 'mmHg') raw data. becomes important later calling annex_prepare().","code":"config ## column variable study home room unit ## 1 loggertime datetime demo_US top_flat ## 2 temperature.kitchen T demo_US top_flat KIT F ## 3 rel.hum.kitchen RH demo_US top_flat KIT - ## 4 exhaust.temperature..Cels. T demo_US top_flat EHA C ## 5 air.pressure Pressure demo_US top_flat AMB mmHg"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"data-overview","dir":"Articles","previous_headings":"Scenario (1)","what":"Data overview","title":"Prepare with time zones & units","text":"better understand happens let us quick look data. summary() returns five number summary plus arithmetic mean variables raw_df object. shown, observations kitchen temperature (second variable) mean NA corresponds 20 degrees Celsius. average relative humidity NA corresponds NA percent. Alternatively can quickly convert raw_df time series object (now loggertime prepared correctly) check data visually clearly shows gaps data:","code":"summary(raw_df) ## loggertime temperature.kitchen rel.hum.kitchen ## Min. :2028-12-28 06:30:00.00 Min. :60.49 Min. :0.3300 ## 1st Qu.:2028-12-29 12:20:00.00 1st Qu.:62.86 1st Qu.:0.8200 ## Median :2028-12-31 09:00:00.00 Median :67.93 Median :0.8900 ## Mean :2028-12-31 03:55:05.44 Mean :68.00 Mean :0.8928 ## 3rd Qu.:2029-01-01 14:50:00.00 3rd Qu.:73.15 3rd Qu.:0.9600 ## Max. :2029-01-03 00:20:00.00 Max. :75.72 Max. :1.1000 ## NA's :8 NA's :33 ## exhaust.temperature..Cels. air.pressure ## Min. :39.52 Min. :647.8 ## 1st Qu.:40.16 1st Qu.:677.2 ## Median :42.38 Median :680.1 ## Mean :46.10 Mean :678.8 ## 3rd Qu.:52.08 3rd Qu.:685.4 ## Max. :60.20 Max. :701.2 ## NA's :376 library(\"zoo\") raw_zoo <- zoo(raw_df[, -1], raw_df[, 1]) plot(raw_zoo)"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"prepare-the-data","dir":"Articles","previous_headings":"Scenario (1)","what":"Prepare the data","title":"Prepare with time zones & units","text":"can now use raw_df combination config object prepare data next step. step, units automatically converted (variables conversion defined). function also reshapes data, however, one can see temperature data (contains temperature data exhaust well kitchen) now degrees Celsius; relative humidity automatically converted percent.","code":"library(\"annex\") prepared_df <- annex_prepare(raw_df, config) head(prepared_df) ## datetime study home room Pressure T RH ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 900.5433 NA NA ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 901.9993 NA NA ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 901.5005 NA NA ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 904.6508 NA NA ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 905.8652 NA NA ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 903.9762 NA NA summary(prepared_df) ## datetime study home ## Min. :2028-12-28 06:30:00.00 Length:2151 Length:2151 ## 1st Qu.:2028-12-29 12:20:00.00 Class :character Class :character ## Median :2028-12-31 09:00:00.00 Mode :character Mode :character ## Mean :2028-12-31 03:55:05.44 ## 3rd Qu.:2029-01-01 14:50:00.00 ## Max. :2029-01-03 00:20:00.00 ## ## room Pressure T RH ## Length:2151 Min. :863.7 Min. :15.83 Min. : 33.00 ## Class :character 1st Qu.:902.8 1st Qu.:20.03 1st Qu.: 82.00 ## Mode :character Median :906.7 Median :39.57 Median : 89.00 ## Mean :904.9 Mean :33.12 Mean : 89.28 ## 3rd Qu.:913.8 3rd Qu.:42.39 3rd Qu.: 96.00 ## Max. :934.9 Max. :60.20 Max. :110.00 ## NA's :1810 NA's :725 NA's :1467"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"calculating-statistics","dir":"Articles","previous_headings":"Scenario (1)","what":"Calculating statistics","title":"Prepare with time zones & units","text":"data set prepared, annex() can called prepare data set final calculations. Note: far, date time information still time zone logger. calling annex() can specify time zone statistics calculated. Correct solution: According scenario know study area located “US/Central” time zone. need tell annex() correctly conversion. shown, first three observations (7 local time) fall period tod = \"23-07\" next ones fall period tod = \"07-23\".","code":"annex_df <- annex(T + RH + Pressure ~ datetime | study + home + room, data = prepared_df, tz = \"US/Central\") head(annex_df) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 07-23 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 07-23 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 07-23 NA NA 903.9762"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"scenario-2","dir":"Articles","previous_headings":"","what":"Scenario (2)","title":"Prepare with time zones & units","text":"illustration, let us imagine situation study located US/Central time zone, however, imagine loggertime reported UTC. Thus, needed () convert loggertime UTC, keep analysis steps relative US/Central time zone (calling annex()). comparing first six observations (rows) object annex_df (handled US/Central time) annex_UTC (raw data UTC, processing US/Central) one can see difference tod variable (also affects year month) …","code":"# Re-reading the original data set; Store it on a new object raw_UTC raw_UTC <- read_excel(\"demo_US.xlsx\", sheet = \"airquality_data\") # Convert loggertime; this time with 'tz = \"UTC\"' raw_UTC$loggertime <- as.POSIXct(x = raw_UTC$loggertime, format = \"%m/%d/%Y %H:%M:%S\", tz = \"UTC\") # Prepare the data relative to US/Central; same 'config' object as before prepared_UTC <- annex_prepare(raw_UTC, config) annex_UTC <- annex(T + RH + Pressure ~ datetime | study + home + room, data = prepared_UTC, tz = \"US/Central\") head(annex_df) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 07-23 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 07-23 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 07-23 NA NA 903.9762 head(annex_UTC) ## datetime study home room year month tod T RH Pressure ## 1 2028-12-28 06:30:00 demo_US top_flat AMB 2028 12 23-07 NA NA 900.5433 ## 2 2028-12-28 06:40:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.9993 ## 3 2028-12-28 06:50:00 demo_US top_flat AMB 2028 12 23-07 NA NA 901.5005 ## 4 2028-12-28 07:00:00 demo_US top_flat AMB 2028 12 23-07 NA NA 904.6508 ## 5 2028-12-28 07:10:00 demo_US top_flat AMB 2028 12 23-07 NA NA 905.8652 ## 6 2028-12-28 07:20:00 demo_US top_flat AMB 2028 12 23-07 NA NA 903.9762"},{"path":"https://some.example-url.com/articles/prepare_xtra.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next steps","title":"Prepare with time zones & units","text":"performing data preparation, following steps can performed: Calculating statistics (analysis) Visualizing data (optional) Write annex stats final file Update meta data final file Validate final file","code":""},{"path":"https://some.example-url.com/articles/unitconversion.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Unit conversion","text":"TODO(R): Yet written.","code":""},{"path":"https://some.example-url.com/articles/visualization.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Visualization (plotting)","text":"package comes simple default plots annex objects (returned annex()). following demonstration based example shown article Prepare data XLSX, using file demo_UIBK.xlsx (please read Prepare data XLSX details).","code":"library(\"readxl\") # Reading measurement data raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") # Read and prepare config object config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Remove all rows process = FALSE # Prepare annex object library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") dim(annex_df) ## [1] 43500 10 class(annex_df) ## [1] \"annex\" \"data.frame\""},{"path":"https://some.example-url.com/articles/visualization.html","id":"plotting","dir":"Articles","previous_headings":"Introduction","what":"Plotting","title":"Visualization (plotting)","text":"prepared, can call default (base R) plotting methods: Additional arguments start end can given (either objects class POSIXt characters ISO format) plot specific time period.","code":"plot(annex_df) plot(annex_df, start = \"2011-10-03\", end = \"2011-10-04\")"},{"path":"https://some.example-url.com/articles/visualization.html","id":"using-ggplot2","dir":"Articles","previous_headings":"Introduction","what":"Using ggplot2","title":"Visualization (plotting)","text":"‘long form’ stats can handy plotting ggplot. ensure long form, annex_stats_reshape() can called. already long format simply return , else reshaped wide format desired long format. Empirical CDF: stats contains series quantiles following naming scheme \"^p[0-9\\\\.]+$\" (e.g., p00, p02.5, …). code chunk subsets statistics get rows containing empirical quantiles, appends additional variable p numeric value percentile required demo plot following afterwards.","code":"stats <- annex_stats(annex_df) stats <- annex_stats_reshape(stats, format = \"long\") head(stats, n = 2) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 # Extracting rows with empirical quantiles tmp <- stats[grepl(\"^p[0-9\\\\.]+$\", stats$stats), ] # Extract numeric value for plotting tmp$p <- as.numeric(gsub(\"p\", \"\", tmp$stats)) # Unique ID as an interaction of study, home, room, month, and tod tmp$ID <- with(tmp, interaction(study, home, room, month, tod)) library(\"ggplot2\") ggplot(subset(tmp, variable == \"T\")) + geom_line(aes(x = p, y = value, col = home, group = ID)) + facet_wrap(~ room, scale = \"free\") + ggtitle(\"Empirical Cumulative Distribution Function of Temperature by Room Type\") ggplot(subset(tmp, variable == \"CO2\")) + geom_line(aes(x = p, y = value, col = interaction(month, tod, sep = \" - \"), group = ID)) + facet_wrap(~ room) + ggtitle(\"Empirical Cumulative Distribution Function of CO2 Concentration by Room Type\") ggplot(subset(tmp, variable == \"RH\")) + geom_line(aes(x = p, y = value, col = room, group = ID)) + facet_wrap(~ home) + ggtitle(\"Empirical Cumulative Distribution Function of Relative Humidity by Home\")"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Write and validate output","text":"article demonstrates write processed data (annex statistics) final pre-filled XLSX file validate file format. example based demo data set demo_UIBK.xlsx , details following code chunk please read article Prepare data XLSX.","code":"library(\"readxl\") # Reading measurement data raw_df <- read_excel(\"demo_UIBK.xlsx\", sheet = \"measurements\") # Read and prepare config object config <- read_excel(\"demo_UIBK.xlsx\", sheet = \"annex_configuration\") config <- subset(config, process == TRUE) # Remove all rows process = FALSE # Prepare annex object library(\"annex\") prepared_df <- annex_prepare(raw_df, config, quiet = TRUE) annex_df <- annex(RH + T + CO2 ~ datetime | study + home + room, data = prepared_df, tz = \"Europe/Berlin\") stats <- annex_stats(annex_df, format = \"long\") head(stats) ## study home room year month tod variable stats value ## 1 demo General AMB 2011 10 all RH quality_lower 0 ## 2 demo General AMB 2011 10 all RH quality_upper 0 ## 3 demo General AMB 2011 10 all RH quality_start 15248 ## 4 demo General AMB 2011 10 all RH quality_end 15253 ## 5 demo General AMB 2011 10 all RH interval_Min 300 ## 6 demo General AMB 2011 10 all RH interval_Q1 300"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"write","dir":"Articles","previous_headings":"","what":"Write annex statistics to file","title":"Write and validate output","text":"statistics calculated, data - returned annex_stats() - can written final ouput file. function annex_write_stats() create new XLSX file based annex template, store calculated statistics, pre-fill series META sheets take required meta information. information must added manually user.","code":"annex_write_stats(stats, file = \"final_UIBK.xlsx\", user = 1234) ## Get a copy of the template ## Starting to write final_UIBK.xlsx ## - Writing META-Study ## - Write 1 rows into 'META-Study' ## - Writing META-Home ## - Write 19 rows into 'META-Home' ## - Writing META-Room ## - Write 27 rows into 'META-Room' ## - Writing META-Variable ## - Write 80 rows into 'META-Variable' ## - Writing STAT ## - Saving file"},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"where-to-get-a-user-id","dir":"Articles","previous_headings":"Write annex statistics to file","what":"Where to get a user ID?","title":"Write and validate output","text":"defined Annex 86 meetings contact Gabriel.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"meta","dir":"Articles","previous_headings":"","what":"Update meta information","title":"Write and validate output","text":"point, XLSX file final_UIBK.xlsx contain statistics, missing meta information. additional information needed, XLSX sheet contains placeholders like <....> (check META sheets) need updated user. columns/fields require meta information, others optional. optional meta information available, placeholders (<....>) can also deleted. annex_validate() inform user needs done: WARNING: Required meta information missing (either empty placeholder) NOTE: still contains placeholder. case simply replace placeholder correct meta information delete (optional information). time file can validated (see next section) see everything according requested standard information still missing invalid information entered.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"append-or-update-the-xlsx-file","dir":"Articles","previous_headings":"","what":"Append or update the XLSX file","title":"Write and validate output","text":"function write_annex_stats() argument mode defaults \"write\" provides two alternative modes: \"append\" \"update\". two modes allow write additional/updated statistics existing XLSX file preserve already added meta information (see section ). Append: Append new data existing file. function throw error new data overlaps existing one. Update: replace existing data STAT new data overlaps existing data XLSX file. Note mode = \"update\" overwrite existing data may result loss data potentially replaces existing records new partial data depending new object provided. Consider making backup XLSX file beforehand. WARNING: two modes \"append\" \"update\" early stage may unexpected outcomes. Feel free test modes report problems/issues. One known issue work properly XLSX file saved using libreoffice/openoffice using versino openxlsx prior version 4.2.5.9001. latest version (currently available via github April 21, 2023) resolves problem. details see (closed) issue #9.","code":""},{"path":"https://some.example-url.com/articles/write_and_validate.html","id":"validate","dir":"Articles","previous_headings":"","what":"Validate final file","title":"Write and validate output","text":"function annex_validate() performs series checks original template (included package; always uses current version) well within XLSX file provided input. critical checks result exception (error; stops execution) well checks resulting notes user. notes tell ’s wrong missing allow user make appropriate changes, validating file . function returns TRUE FALSE (throw error), TRUE returned everything OK file required meta information entered properly. stage, file can used processing upload research repository (planned near future). case changes made file written annex_write_stats(). illegal changes made, critical errors detected. However, series messages printed inform everything filled properly. Simply open file spreadsheet editing software choice (MS Excel, Libreoffice, …), make required changes, save file, repeat validation annex_validate() happy returns TRUE.","code":"check <- annex_validate(\"final_UIBK.xlsx\", user = 1234) ## Checking columns in all sheets ## ## 'META-Study' ........ OK ## 'META-Home' ......... OK ## 'META-Room' ......... OK ## 'META-Variable' ..... OK ## 'Definitions' ....... OK ## Validating XLSX sheet STAT ## Everything OK (no warnings) ## Validating XLSX sheet META-Study ## ## WARNING: 'META-Study' column 'Contact' missing required info for ID: 1234-demo (row: 2) ## WARNING: 'META-Study' column 'Institution' missing required info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Year of first publication' provides no info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Publications' provides no info for ID: 1234-demo (row: 2) ## NOTE: 'META-Study' column 'Links' provides no info for ID: 1234-demo (row: 2) ## Validating XLSX sheet META-Home ## ## WARNING: 'META-Home' column 'Location: Country' missing required info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Location: City' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## WARNING: 'META-Home' column 'Ventilation type' missing required info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Comment Vent. Type' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Ventilation rate (entire home; [l/s])' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Method of vent. rate determination' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Comment vent. Rate determination' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightn. [xx]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightness ref press [Pa]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Airtightness normalization value' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Type of building' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Size of home / TFA [m^2]' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Type of Occupants' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Constr. type / building materials' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Energy standard' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## NOTE: 'META-Home' column 'Year of contruction / major renovation (four digit year)' provides no info for IDs: 1234-demo-General, 1234-demo-W1, 1234-demo-W10, 1234-demo-W11, 1234-demo-W12 and 14 more (rows: 2, 3, 4, 5 and 15 more) ## WARNING: 'Location: Country' in 'META-Home' not in ISO3 standard, found: , , , , , , , , , , , , , , , , , , (rows: 2, 3, 4, 5, 6 and 14 more). ## See `?annex_countries` to get all allowed country abbrevations (ISO3166 alpha-3; ISO3). ## Validating XLSX sheet META-Room ## ## NOTE: 'META-Room' column 'Additionial room information (e.g., ceiling height, with atrium)' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Occupancy: Type' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Occupancy: Number' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Fresh air supply in measurement location' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Ventilation rate (room; [l/s])' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Method of vent. rate determination' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## NOTE: 'META-Room' column 'Comments' provides no info for IDs: 1234-demo-General-AMB, 1234-demo-General-ETA, 1234-demo-General-SUP, 1234-demo-W1-LIV, 1234-demo-W10-LIV and 22 more (rows: 2, 3, 4, 5 and 23 more) ## Everything OK (no warnings) ## Validating XLSX sheet META-Variable ## ## NOTE: 'META-Variable' column 'Variable additional information' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## NOTE: 'META-Variable' column 'Measurement device' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## NOTE: 'META-Variable' column 'Comments (e.g., sensor location)' provides no info for IDs: 1234-demo-General-AMB-RH, 1234-demo-General-AMB-T, 1234-demo-General-ETA-CO2, 1234-demo-General-ETA-RH, 1234-demo-General-ETA-T and 75 more (rows: 2, 3, 4, 5 and 76 more) ## Everything OK (no warnings) ##"},{"path":"https://some.example-url.com/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Reto Stauffer. Maintainer, author. Gabriel Rojas-Kopeinig. Funder, author. Tobias Grass. Author. Constanza Molina. Contributor. Fabián Sepúlveda. Contributor. Benjamin Jones. Contributor. James McGrath. Contributor. Francesco Babich. Contributor. Irene Lara Ibeas. Contributor. Akshit Gupta. Contributor. Marc Abadie. Contributor.","code":""},{"path":"https://some.example-url.com/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Stauffer R, Rojas-Kopeinig G, Grass T (2023). annex: IEA EBC Annex86 Data Analysis Package. R package version 0.2-9, https://github.com/IEA-EBC-Annex86/annex/.","code":"@Manual{, title = {annex: IEA EBC Annex86 Data Analysis Package}, author = {Reto Stauffer and Gabriel Rojas-Kopeinig and Tobias Grass}, year = {2023}, note = {R package version 0.2-9}, url = {https://github.com/IEA-EBC-Annex86/annex/}, }"},{"path":[]},{"path":"https://some.example-url.com/contact.html","id":"reporting-bugs","dir":"","previous_headings":"","what":"Reporting bugs","title":"Contact","text":"TODO(R): report bugs; publish package github use github issues? Mail?","code":""},{"path":[]},{"path":"https://some.example-url.com/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"IEA EBC Annex86 Data Analysis Package","text":"R package annex provides series functions methods easily process measurement data IEA EBC Annex86 project, well writing (validating) final file intended used build data repository research field related project. Install via remotes package currently hosted github can installed via remotes package calling remotes::install_github() within active R session. Note may need install remotes package first. Dependencies annex package available via repository dependencies required process data. R automatically resolve backwards dependencies installation. information, look DESCRIPTION file github.com.","code":"library('remotes') install_github(\"IEA-EBC-Annex86/annex\")"},{"path":"https://some.example-url.com/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"IEA EBC Annex86 Data Analysis Package","text":"figure shows schematic process use annex package process measurements well create validate final standardized output file. first, user needs import required data sets /. annex package provide functionality data come various different formats, however, documentation provides examples case data available XLSX format tabular text files (see Analysis XLSX Analysis textfiles), package limited . needed provide data proper R data.frames processing. function annex_prepare() helper function prepare measurement data set processing steps (can bypassed needed). annex() creator function annex objects. defines process performs series checks. annex_stats() takes annex object previous step calculate statistics (aggregated statistical mesures); returns annex_stats object. object previous step can written final XLSX file. result XLSX file containing statistics well pre-filled sheets required meta information. information filled manually user. annex_validate() can used check meta information filled properly manual interaction user required. validation happy XLSX file, analysis completed final analysis can e.g., submitted upcoming research repository used analysis.","code":""},{"path":"https://some.example-url.com/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"IEA EBC Annex86 Data Analysis Package","text":"Documentation examples available github.io https://iea-ebc-annex86.github.io/annex/ documentation contains series articles explain use annex package well additional information regarding package functionality.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":null,"dir":"Reference","previous_headings":"","what":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"List countries ISO-2 ISO-3 abbrevations. Used validate final XLSX file.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"Returns data.frame containing country name alongside ISO2 ISO3 short name (ISO 3116 alpha-2 alpha-3 standard).","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"IBAN (2023). COUNTRY CODES ALPHA-2 & ALPHA-3, https://www.iban.com/country-codes, accessed 2023-02-11.","code":""},{"path":"https://some.example-url.com/reference/ISO3166.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — ISO3166","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Annex Creator Function — annex","title":"Annex Creator Function — annex","text":"Creates object class c(\"annex\", \"data.frame\") required calculate statistics.","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annex Creator Function — annex","text":"","code":"annex(formula, data, tz, duplicate.action = NULL, meta = NULL, verbose = FALSE) # S3 method for annex head(x, ...) # S3 method for annex tail(x, ...) # S3 method for annex subset(x, ...) # S3 method for annex_stats head(x, ...) # S3 method for annex_stats tail(x, ...) # S3 method for annex_stats subset(x, ...)"},{"path":"https://some.example-url.com/reference/annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annex Creator Function — annex","text":"formula formula specify data set set . See 'Details' information. data data.frame containing obervations/data. tz character, time zone definition (e.g., \"Europe/Berlin\" \"UTC\"); required. OlsonNames() returns list possible time zones. correct time zone important properly calculate month time day. duplicate.action NULL function returns single numeric value. Used handle possible duplicates, see 'Details'. meta NULL (default) list information study, home, room (see section 'Duplicates'). verbose logical, defaults FALSE. Can set TRUE increase verbosity. x object class annex. ... arguments passed methods.","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Annex Creator Function — annex","text":"case data set provided data contain data one study, home, room, fomula two parts, looking e.g., follows: T + RH ~ datetime left hand side formula (left ~) specifies names variables observations processed, right hand side name variable containing time information (must class POSIXt). case, meta argument required provide information study, home, room. grouping information already data set, analysis can performed depending group information, typically: T + RH ~ datetime | study + home + room latter allows process observations different studies, homes, /rooms one go.","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"duplicates","dir":"Reference","previous_headings":"","what":"Duplicates","title":"Annex Creator Function — annex","text":"Duplicated records can distort statistics handled properly. unique study, home, room one observation (row) specific date time exist. general way deal duplicates, function annex (well annex_prepare) default throws warning user duplicates exist (duplicate.action = NULL; default argument). However, package allows user provide custom duplicate.action function, e.g., mean, min, max, ... function must return one single numeric value (NA) applied vector. function provided, annex function following: Checks duplicates. , changes made. Else ... Checking function valid (returns single numeric NA). , error thrown. Takes measurements duplicate; values missing, NA returned. Else users duplicate.action applied remaining non-missing values. .e., duplicate.action = mean average non-missing values used.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Annex Creator Function — annex","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annex Creator Function — annex","text":"","code":"# Create artificial data set for testing; typically this information is read # from a file or any other data connection. data <- data.frame(datetime = as.POSIXct(\"2022-01-01 00:00\", tz = \"Europe/Berlin\") + -10:10 * 3600, T = round(rnorm(21, mean = 20, sd = 2), 2), RH = round(runif(21, 40, 100), 2)) res1 <- annex(T + RH ~ datetime, data = data, meta = list(study = \"example\", home = \"ex\", room = \"BED\"), tz = \"Europe/Berlin\") head(res1, n = 3) #> datetime study room home year month tod T RH #> 1 2021-12-31 14:00:00 example BED ex 2021 12 07-23 21.81 80.27 #> 2 2021-12-31 15:00:00 example BED ex 2021 12 07-23 17.71 78.26 #> 3 2021-12-31 16:00:00 example BED ex 2021 12 07-23 20.29 46.02 # The meta information can also be added to `data` removing the need # to specify the `meta` argument and allows to mix data from different # studies and rooms. Appending study, room, and home to `data`: data <- transform(data, study = \"example\", home = \"ex\", room = \"BED\") head(data) #> datetime T RH study home room #> 1 2021-12-31 14:00:00 21.81 80.27 example ex BED #> 2 2021-12-31 15:00:00 17.71 78.26 example ex BED #> 3 2021-12-31 16:00:00 20.29 46.02 example ex BED #> 4 2021-12-31 17:00:00 15.94 70.27 example ex BED #> 5 2021-12-31 18:00:00 19.61 99.26 example ex BED #> 6 2021-12-31 19:00:00 18.72 55.28 example ex BED res2 <- annex(T + RH ~ datetime | study + home + room, data = data, tz = \"Europe/Berlin\") head(res2, n = 3) #> datetime study home room year month tod T RH #> 1 2021-12-31 14:00:00 example ex BED 2021 12 07-23 21.81 80.27 #> 2 2021-12-31 15:00:00 example ex BED 2021 12 07-23 17.71 78.26 #> 3 2021-12-31 16:00:00 example ex BED 2021 12 07-23 20.29 46.02"},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate year, month and time of day — annex_add_year_month_and_tod","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"Calculates year, month time day categories based input argument x respect time zone specified user.","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"","code":"annex_add_year_month_and_tod(x, tz)"},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"x object class POSIXt. tz time zone (character). Important properly calculate month time day.","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"List three elements year (integer), month (factor) tod (factor).","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_add_year_month_and_tod.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate year, month and time of day — annex_add_year_month_and_tod","text":"","code":"x <- as.POSIXct(\"2022-01-01\", tz = \"UTC\") + 0:10 * 3600 annex:::annex_add_year_month_and_tod(x, tz = \"Europe/Berlin\") #> $year #> [1] 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 2022 #> Levels: 2022 #> #> $month #> [1] 1 1 1 1 1 1 1 1 1 1 1 #> Levels: all 1 2 3 4 5 6 7 8 9 10 11 12 #> #> $tod #> [1] 23-07 23-07 23-07 23-07 23-07 23-07 07-23 07-23 07-23 07-23 07-23 #> Levels: 23-07 07-23 #> annex:::annex_add_year_month_and_tod(x, tz = \"US/Central\") #> $year #> [1] 2021 2021 2021 2021 2021 2021 2022 2022 2022 2022 2022 #> Levels: 2021 2022 #> #> $month #> [1] 12 12 12 12 12 12 1 1 1 1 1 #> Levels: all 1 2 3 4 5 6 7 8 9 10 11 12 #> #> $tod #> [1] 07-23 07-23 07-23 07-23 07-23 23-07 23-07 23-07 23-07 23-07 23-07 #> Levels: 23-07 07-23 #>"},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking Annex Config — annex_check_config","title":"Checking Annex Config — annex_check_config","text":"'annex config object' simple data.frame can created using Rs standard features. function checking content object matches requirements annex config object. check performed link{annex()} automatically, can also done user manually.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking Annex Config — annex_check_config","text":"","code":"annex_check_config(x)"},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking Annex Config — annex_check_config","text":"x object class data.frame checked.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking Annex Config — annex_check_config","text":"Invisibly returns (possibly modified) version x containing required columns specific order.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Checking Annex Config — annex_check_config","text":"function checks config object set properly contains required information preparing annex data. Throws errors : input data.frame variables missing ('column', 'variable', 'unit', 'study', 'home', 'room') configuration variable = \"datetime\" missing definition variables (datetime ) config contains missing values required variables column name variable = \"datetime\" missing variable 'column' unique duplicated entries combination variable/study/home/room (must unique) variables study, home room contain contain non-allowed characters. Must contain letters (lowercase uppercase), numbers, underscores. Must start letter.","code":""},{"path":"https://some.example-url.com/reference/annex_check_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking Annex Config — annex_check_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking Annex Stats to XML — annex_check_stats_object","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"Used checking/validating annex_stat objects; used internally annex_write_stats() ensure users (try ) store final XLSX files expected final output file.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"","code":"annex_check_stats_object(x)"},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"x object class annex_stat returned annex_stats().","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"return, throw error something match expected file format.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"following checked: Input correct type least one observation.","code":""},{"path":"https://some.example-url.com/reference/annex_check_stats_object.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking Annex Stats to XML — annex_check_stats_object","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":null,"dir":"Reference","previous_headings":"","what":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Country codes (ISO 3166) alpha-2 alpha-3","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"","code":"annex_countries()"},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Returns data set ISO3166 shipped package (see ?ISO3166 details).","code":""},{"path":"https://some.example-url.com/reference/annex_countries.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Country codes (ISO 3166) alpha-2 and alpha-3 — annex_countries","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_handle_duplicates.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","title":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","text":"function called inside annex().","code":""},{"path":"https://some.example-url.com/reference/annex_handle_duplicates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","text":"","code":"annex_handle_duplicates(x, formula, duplicate.action, verbose = FALSE)"},{"path":"https://some.example-url.com/reference/annex_handle_duplicates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","text":"x data.frame processed. formula object class Formula, formula provided annex(). duplicate.action can NULL (dedicated handling duplicates) function. function must return single numeric value, tested able provide useful error user needed. verbose logical, verbosity (defaults FALSE).","code":""},{"path":"https://some.example-url.com/reference/annex_handle_duplicates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","text":"Returns data.frame similar argument x possibly modified content (depending deal duplicates ).","code":""},{"path":"https://some.example-url.com/reference/annex_handle_duplicates.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Internal Function for Handling Possible Duplicates — annex_handle_duplicates","text":"Reto","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":null,"dir":"Reference","previous_headings":"","what":"Parsing Formula — annex_parse_formula","title":"Parsing Formula — annex_parse_formula","text":"Function used test parse formula used different functions annex package.","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parsing Formula — annex_parse_formula","text":"","code":"annex_parse_formula(f, verbose = FALSE)"},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parsing Formula — annex_parse_formula","text":"f object class Formula. verbose logical, defaults FALSE. Can set TRUE increase verbosity.","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parsing Formula — annex_parse_formula","text":"Returns list three components, namely vars (variables aggregate), time (name datetime variable) group (grouping variables).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Parsing Formula — annex_parse_formula","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_parse_formula.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parsing Formula — annex_parse_formula","text":"","code":"require(\"Formula\") #> Loading required package: Formula annex:::annex_parse_formula(Formula(T + RH ~ datetime | study + room + home)) #> $vars #> [1] \"T\" \"RH\" #> #> $time #> [1] \"datetime\" #> #> $group #> [1] \"study\" \"room\" \"home\" #>"},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":null,"dir":"Reference","previous_headings":"","what":"Prepare Annex Data — annex_prepare","title":"Prepare Annex Data — annex_prepare","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prepare Annex Data — annex_prepare","text":"","code":"annex_prepare(x, config, quiet = FALSE)"},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Prepare Annex Data — annex_prepare","text":"x data.frame, data . config data.frame, config information (see annex_check_config()). quiet logical, default FALSE. set TRUE, messages warnings suppressed.","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Prepare Annex Data — annex_prepare","text":"Prepared data.frame processing annex package.","code":""},{"path":"https://some.example-url.com/reference/annex_prepare.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Prepare Annex Data — annex_prepare","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Reading Annex Statistics from XLSX — annex_read_stats","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"final data set (annex statistics) written XLSX file. function allows read one multiple files R.","code":""},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"","code":"annex_read_stats(file, raw = FALSE, validate = TRUE)"},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"file character, name file(s) imported. Must end XLSX (case sensitive). raw logical. FALSE single data.frame returned, containing statistics file(s). set TRUE raw information XLSX file(s) returned (see Details). validate logical, TRUE (default) function first validates XLSX file valid given current version annex.","code":""},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"object class c(\"annex_xlsx_stats\", \"data.frame\") named list data.frames. Depends argument raw, see section 'Details'.","code":""},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"XLSX files (valid) contain series sheets, namely 'STATS', 'META-Study', 'META-Home', 'META-Room', 'META-Variable' containing data information. function two different returns (depending combine). raw = FALSE (default) 'STAT' sheet imported. one file information files combined one data.frame returned. raw = TRUE information sheets read stored named list. multiple files, content different sheets combined. return named list length 5 containing data.frame . usability purposes sheet names modified, replacing \"-\" (XLSX) \"_\" (names list).","code":""},{"path":"https://some.example-url.com/reference/annex_read_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Reading Annex Statistics from XLSX — annex_read_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":null,"dir":"Reference","previous_headings":"","what":"Room definition information — annex_room_definition","title":"Room definition information — annex_room_definition","text":"template contains series base abbrevations allowed define room alongside 'long name'. function returns definition data.frame.","code":""},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Room definition information — annex_room_definition","text":"","code":"annex_room_definition()"},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Room definition information — annex_room_definition","text":"data.frame base room abbrevation, long description, plus series examples valid room labels.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_room_definition.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Room definition information — annex_room_definition","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate Statistics on Annex object — annex_stats","title":"Calculate Statistics on Annex object — annex_stats","text":"Calculate Statistics Annex object","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate Statistics on Annex object — annex_stats","text":"","code":"annex_stats(object, format = \"wide\", ..., probs = NULL)"},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate Statistics on Annex object — annex_stats","text":"object object class annex. format character, either \"wide\" (default) \"long\". ... currently unused. probs NULL (default; see Details) numeric vector probabilities values [0,1] (Values rounded closest 3 digits).","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate Statistics on Annex object — annex_stats","text":"Returns object class c(\"annex_stats\", \"data_frame\").","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Calculate Statistics on Annex object — annex_stats","text":"function allows return statistics wide format long format. can used calling annex_write_stats(), long/wide format can handy fur custom applications (e.g., plotting, ...). Argument probs forwarded stats::quantile() function. probs = NULL (default) empirical quantiles calculated 0 (minimum) 1 (maximum) interval 0.01 (one percent steps), including quantiles 0.005, 0.025, 0.975 0.995. Can specified differently user needed, however, longer yields standard statistics validation report problem.","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"statistics","dir":"Reference","previous_headings":"","what":"Statistics","title":"Calculate Statistics on Annex object — annex_stats","text":"Grouping: Statistics calculated different subsets (groups), typically study, home, room, year, month, tod (time day). However, set can vary depending users function call annex (see argument formula). annex_stats calculates series data/quality flags well statistical measures. Quality: quality_lower quality_upper contain fraction observations (percent) falling lower upper defined threshold (see annex_variable_definition). quality_start quality_end contain day (date ) first non-missing observation given current group; used estimate Nestim (see ). Interval: Time increments non-missing observations calculated seconds. interval_ columns show five digit summary plus arithmetic mean intervals. interval_Median used calculate estimate Nestim (see ). Nestim: Number estimated observations (see section ) N: Number non-missing observations NAs: Number missing observations (NA data set) Mean: $$\\bar{x} = \\frac{1}{N} \\sum_{= 1}^N x_i$$ (arithmetic mean) Sd: $$\\text{sd}(x) = \\sqrt{\\frac{1}{N - 1} \\sum_{= 1}^N \\big( (x_i - \\bar{x})^2\\big)}$$ p: Probabilites different quantiles. p00 represents overall minimum, p50 median, p100 overall maximum non-missing values. Uses empirical quantile function type = 7 (default; see quantile).","code":""},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"estimated-number-of-observations","dir":"Reference","previous_headings":"","what":"Estimated number of observations","title":"Calculate Statistics on Annex object — annex_stats","text":"value Nestim contains estimate number possible observations specific group. estimate based first/last date observation available (non-missing) well year, month, tod. Last least interval_Median used. example: Imagine statistics temperature observations one speicifc year month (monthly level aggregation) tod = \"07-23\". first non-missing value reported first day month, last one day 10. Given tod = \"07-23\" covers 16 hours, indicates observations available 16 hours 10 days = 160 hours total. Based best guess interval_median allows calculate Nestim. E.g., median interval 300 (300 seconds = 5 minutes) leas possible number observations Nestim = 10 days * 16 hours per day * 3600 seonds per hour / 300 seconds = 1920. Keep mind estimate best guess!","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate Statistics on Annex object — annex_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":null,"dir":"Reference","previous_headings":"","what":"Reshaping Annex Stats Objects — annex_stats_reshape","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Reshaping Annex Stats Objects","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"","code":"annex_stats_reshape(x, format = NULL)"},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"x object class annex_stats returned annex_stats(). format NULL default one \"long\" \"wide\" (see Details).","code":""},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Returns reshaped version input. Object provided x inherits annex_stats_wide (wide format) long format returned vice versa format = NULL. format specified either \"long\" \"wide\" long wide format returned (possibly unmodified version input input already desired format).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_stats_reshape.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Reshaping Annex Stats Objects — annex_stats_reshape","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Copy of annex Output Template — annex_template","title":"Create Copy of annex Output Template — annex_template","text":"main aim annex package standardize data sets IEA EBC Annex86 project. create output file, annex_write_stats() uses template XLSX file (shipped package). function allows make local copy check format template needed.","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Copy of annex Output Template — annex_template","text":"","code":"annex_template(file, overwrite = FALSE)"},{"path":"https://some.example-url.com/reference/annex_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Copy of annex Output Template — annex_template","text":"file name file written, must end xlsx (case sensitive). overwrite logical, default FALSE. Can set TRUE overwrite existing file (aware loss data).","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create Copy of annex Output Template — annex_template","text":"return.","code":""},{"path":"https://some.example-url.com/reference/annex_template.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create Copy of annex Output Template — annex_template","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate annex Output File — annex_validate","title":"Validate annex Output File — annex_validate","text":"Validate XLSX file created annex_write_stats(). Checks required sheets/columns available user-modified META information entered correctly.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate annex Output File — annex_validate","text":"","code":"annex_validate(file, user, quiet = FALSE, ...)"},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate annex Output File — annex_validate","text":"file name file validated (XLSX file). user positive integer, user identifier given project team. quiet logical, defaults FALSE. TRUE, output limited. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate annex Output File — annex_validate","text":"checks cause error stop execution. Others cause message information fixed make document valid. function stop due error return TRUE file validated proper, FALSE issues found.","code":""},{"path":"https://some.example-url.com/reference/annex_validate.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Validate annex Output File — annex_validate","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":null,"dir":"Reference","previous_headings":"","what":"Variable definition information — annex_variable_definition","title":"Variable definition information — annex_variable_definition","text":"template contains definition allowed variables, also states whether additional information required (optional), upper lower bound considered 'valid' plus (specified) series allowed units. Used prepare data convert annex standard units, quality checks, well validation.","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Variable definition information — annex_variable_definition","text":"","code":"annex_variable_definition(as_list = FALSE)"},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Variable definition information — annex_variable_definition","text":"as_list logical. FALSE (default) data.frame returned, TRUE list (see Details).","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Variable definition information — annex_variable_definition","text":"Returns either data.frame list lists contains allowed (defined) variables.","code":""},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Variable definition information — annex_variable_definition","text":"as_list = TRUE list lists returned, else data.frame. List: name list corresponds name variable, whereas entry contains list logical flag additional information META sheet required well numeric lower upper bound defines range observation considered valid. Can NA specified (one ). allowed_units contains NA (unspecified) character wich one multiple comma separated units specifications. as_list = FALSE (default) information returned data.frame containing information.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/annex_variable_definition.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Variable definition information — annex_variable_definition","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Writing Annex Stats to Disc — annex_write_stats","title":"Writing Annex Stats to Disc — annex_write_stats","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Writing Annex Stats to Disc — annex_write_stats","text":"","code":"annex_write_stats(x, file, user, mode = \"write\", ..., quiet = FALSE)"},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Writing Annex Stats to Disc — annex_write_stats","text":"x object class annex_stat returned annex_stats() (wide long format). file name (path) XLSX file store data. Must end xlsx (case sensitive). See 'Details'. user positive integer, user identifier given project team. appended data set. mode, character, writing mode. Can one \"write\" (default), \"append\" (add new data) \"update\" (update existing data). See 'Mode' information. ... yet used. quiet logical. set TRUE messages printed.","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Writing Annex Stats to Disc — annex_write_stats","text":"return, creates new XLSX file (see argument file) stores data, updates existing XLSX file (see argument section 'Writing mode').","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Writing Annex Stats to Disc — annex_write_stats","text":"function used write annex statistics - final output - XLSX file. output based template file shipped package predefined format. output file exist, template copied modified () saving data \"STAT\" sheet well pre-filling additional meta sheets manually edited/entered user. default, overwrite = FALSE. output file already exists, function terminated. However, can set TRUE allow annex_write_stats() manipulate/overwrite current data XLSX file. tries preserve custom data (TODO(R): yet implemented).","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"writing-mode","dir":"Reference","previous_headings":"","what":"Writing mode","title":"Writing Annex Stats to Disc — annex_write_stats","text":"three writing modes. Warning: Depending mode used, existing data can get lost (.e., removed). following modes available: write: Default mode, write data fresh XLSX file. assumed output file yet exist. exists error thrown unkown user like append new data existing file update (overwrite) data existing file. append: Append data existing XLSX file. mode expects file already exist correct format (check sheets columns template). file exist content file follow format template, error thrown. mode = \"append\" falls back mode = \"write\" output file yet exist. Else data x appended sheet 'STAT' additional entries 'META*' sheets created needed. case new object x contains data already STAT error thrown (new data appended must unique). update: Update data existing file. Warning: delete (drop) existing data sheet 'STAT' append new entries 'META*' sheets (delete existing entries). latter cause additional warnings validating file 'META*' entries longer needed (data deleted).","code":""},{"path":"https://some.example-url.com/reference/annex_write_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Writing Annex Stats to Disc — annex_write_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking for Allowed Rooms — check_for_allowed_rooms","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"XLSX file template.xlsx contains series pre-defined names rooms (sheet 'Definitions'). function checks user defined room names valid. case sensitive; adjusted needed.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"","code":"check_for_allowed_rooms(x)"},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"x character vector room names.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"Character vector (possibly adjusted) room names, fails. case sensitive checking, return everything uppercase (toupper(x)).","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/check_for_allowed_rooms.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking for Allowed Rooms — check_for_allowed_rooms","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Checking for Allowed Variables — check_for_allowed_variables","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"XLSX file template.xlsx contains series pre-defined names variables (sheet 'Definitions'). function checks user defined variable names valid. case sensitive; adjusted needed.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"","code":"check_for_allowed_variables(x)"},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"x character vector variable names.","code":""},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"Character vector (possibly adjusted) variable names, fails.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/check_for_allowed_variables.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checking for Allowed Variables — check_for_allowed_variables","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set Bedroom — demo_Bedroom","title":"Demo data set Bedroom — demo_Bedroom","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing measurement data. data set demo_Bedroom_config contains corresponding configuration used calling annex_prepare().","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set Bedroom — demo_Bedroom","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Dummy text 4 — demo_Bedroom_config","title":"Dummy text 4 — demo_Bedroom_config","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing config demo_Bedroom data set, contains actual measurements.","code":""},{"path":"https://some.example-url.com/reference/demo_Bedroom_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Dummy text 4 — demo_Bedroom_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set UIBK (XLSX) — demo_UIBK","title":"Demo data set UIBK (XLSX) — demo_UIBK","text":"One demo data sets used testing documentation/manuals. XLSX file containing , measurements well configuration prepare annex objects.","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set UIBK (XLSX) — demo_UIBK","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK_config.html","id":null,"dir":"Reference","previous_headings":"","what":"Demo data set UIBK config (textfile) — demo_UIBK_config","title":"Demo data set UIBK config (textfile) — demo_UIBK_config","text":"One demo data sets used testing documentation/manuals. tabular text file (CSV alike) containing config information measurement sheet demo_UIBK data set. alternative configuration contained dedicated sheet demo_UIBK data set.","code":""},{"path":"https://some.example-url.com/reference/demo_UIBK_config.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Demo data set UIBK config (textfile) — demo_UIBK_config","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Formats a data frame in specific format — formatting","title":"Formats a data frame in specific format — formatting","text":"Generates new data frame according formula provided.","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Formats a data frame in specific format — formatting","text":"","code":"formatting( data_frame, formula, tz = \"UTC\", format = \"%Y-%m-%d %H:%M:%S\", user = \"\", study = \"\", home = \"\", room = \"\" )"},{"path":"https://some.example-url.com/reference/formatting.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Formats a data frame in specific format — formatting","text":"data_frame data frame formula formula describing specific layout data frame tz time zone like \"UTC\", \"MET\", ... format format time stamps given data frame user abbreviation name respective scientist study natural number (entered character) home natural number (entered character) room abbreviation name respective room","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Formats a data frame in specific format — formatting","text":"Returns data frame specific format according formula provided","code":""},{"path":"https://some.example-url.com/reference/formatting.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Formats a data frame in specific format — formatting","text":"function adds columns referring specific season time day (tod) time stamp. Variables left side, date terms right including season tod well mandatory variables (home, room, etc.). additional variables given, can also found output. mandatory variable present output, message issued. Furthermore, evaluate function annex used unless required variables available. formula passed contains just mandatory variables, evaluate function annex can used without problems. output contains least seven columns addition columns respective variables.","code":""},{"path":[]},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get ID information — get_ID_info","title":"Get ID information — get_ID_info","text":"Used warning error messages. Returns printable string IDs identified.","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get ID information — get_ID_info","text":"","code":"get_ID_info(x, n = 5L, prefix = \" ID\")"},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get ID information — get_ID_info","text":"x character vector. n integer, defaults 5. Number rows explicitly listed (). prefix character NULL, default \"ID\".","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get ID information — get_ID_info","text":"Character string information suspicious values found XLSX file. suspicious rows, FALSE returned.","code":""},{"path":"https://some.example-url.com/reference/get_ID_info.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get ID information — get_ID_info","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":null,"dir":"Reference","previous_headings":"","what":"Get required columns for warnings and infos — get_required_columns","title":"Get required columns for warnings and infos — get_required_columns","text":"Different sheets contain different columns require user specify meta information details (empty cells allowed). function returns names columns (XLSX file) used validation. definition available, NULL returned.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get required columns for warnings and infos — get_required_columns","text":"","code":"get_required_columns(sheet)"},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get required columns for warnings and infos — get_required_columns","text":"sheet character, name XLSX sheet.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get required columns for warnings and infos — get_required_columns","text":"Returns NULL definition/required columns, character vector exact column name used XLSX.","code":""},{"path":"https://some.example-url.com/reference/get_required_columns.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get required columns for warnings and infos — get_required_columns","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get row information — get_row_info","title":"Get row information — get_row_info","text":"Used warning error messages. Returns printable string information find missing, invalid, ... values XLSX file.","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get row information — get_row_info","text":"","code":"get_row_info(x, n = 5L, offset = 1L, prefix = \" Row\")"},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get row information — get_row_info","text":"x integer logical, see 'Details'. n integer, defaults 5. Number rows explicitly listed (). offset integer, number additional header lines XLSX sheet correct row indicator (defaults 1). prefix character NULL, default \" Row\".","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get row information — get_row_info","text":"Character string information suspicious values found XLSX file. suspicious rows, FALSE returned.","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get row information — get_row_info","text":"input class integer assumed values correspond observations data.frame. .e, 1 first observation data.frame. input logical vector assumed entries TRUE suspicious, order corresponds observations data.frame. return value point suspicous rows context XLSX file typically one additional header line (thus default offset = 1L).","code":""},{"path":"https://some.example-url.com/reference/get_row_info.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get row information — get_row_info","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Regularity of an Annex Series — is.regular.annex","title":"Check Regularity of an Annex Series — is.regular.annex","text":".regular regular function checking whether series observations underlying regularity even strictly regular. Evaulate group annex object.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Regularity of an Annex Series — is.regular.annex","text":"","code":"# S3 method for annex is.regular(x, strict = TRUE, ...)"},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Regularity of an Annex Series — is.regular.annex","text":"x object class annex. strict logical, defaults TRUE. FALSE, regularity (strict regularity) checked. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Regularity of an Annex Series — is.regular.annex","text":"Returns named logical vector name combination grouping (study, home, room), content result checking regularity.","code":""},{"path":"https://some.example-url.com/reference/is.regular.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check Regularity of an Annex Series — is.regular.annex","text":"Reto stauffer","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard plot for annex objects — plot.annex","title":"Standard plot for annex objects — plot.annex","text":"TODO(R)","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard plot for annex objects — plot.annex","text":"","code":"# S3 method for annex plot(x, bygroup = FALSE, start = NULL, end = NULL, ...)"},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard plot for annex objects — plot.annex","text":"x object class annex. bygroup logical, default subplots build different variables. TRUE, varables one group plotted one subplot. start start time period interest. end end time period interest. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/plot.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard plot for annex objects — plot.annex","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard plot for annex_stats objects — plot.annex_stats","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"TODO(R): can one plot 5d object?","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"","code":"# S3 method for annex_stats plot(x, ...)"},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"x object class annex. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/plot.annex_stats.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard plot for annex_stats objects — plot.annex_stats","text":"Reto Stauffer","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":null,"dir":"Reference","previous_headings":"","what":"Annex Summary — summary.annex","title":"Annex Summary — summary.annex","text":"Numeric summary annex object.","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annex Summary — summary.annex","text":"","code":"# S3 method for annex summary(object, type = \"default\", ...)"},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annex Summary — summary.annex","text":"object object class annex. type character, one \"default\" (default) \"statistic\". type = \"statistics\" result annex_stats(object) printed. ... currently unused.","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Annex Summary — summary.annex","text":"Returns NULL (invisible).","code":""},{"path":"https://some.example-url.com/reference/summary.annex.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Annex Summary — summary.annex","text":"Reto stauffer","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-9","dir":"Changelog","previous_headings":"","what":"annex 0.2-9","title":"annex 0.2-9","text":"Added additional check annex_prepare() ensure data columns numeric. one variables provided numeric contains missing values (e.g., logical NAs) column converted automatically (NA_real_). Else (numeric missing) error thrown. New feature: annex() new argument duplicate.action allows user specify like handle duplicated observations (observations date time specific room). See ?annex section ‘Duplicates’ details. annex_validate(..., quiet = FALSE) now quiet. Adding new function annex_read_stats() allows import data one multiple XLSX files written annex_write_stats() (beta). Removing ventilation type ‘Exhaust air’ added 0.2-8 annex_stats() returns NAs less 10 valid observations fall one segment columns; annex_validate() understands , additional test_92_smallN.R added.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-8","dir":"Changelog","previous_headings":"","what":"annex 0.2-8","title":"annex 0.2-8","text":"Added additional ventilation type definitions (Exhaust air)","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-7","dir":"Changelog","previous_headings":"","what":"annex 0.2-7","title":"annex 0.2-7","text":"Fixed serious issue intervals (often measurements reported) also affects estimate many observations estimate (think ). Added new variable Flow (air flow) ’s conversions; defaults l/s (liters per second) allowing values (via annex config) m3/h (quibic meters per hour) cfm (suare feet per minute).","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-6","dir":"Changelog","previous_headings":"","what":"annex 0.2-6","title":"annex 0.2-6","text":"issue openxlsx fixed, using openxlsx >= 4.2.5.9001 annex shoul work expected using MS Excel. mean time one small issue openxlsx adressed (opening/modifying .xlsx files openoffice). See issue 9 details. Modified variable definition. Minor renaming, modified/added lower upper bounds well allowed units. addition … … series unit conversion functions added. Updated vignettes (documentation) new code base. Updated extended tinytests new release; mainly unit conversions.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-4","dir":"Changelog","previous_headings":"","what":"annex 0.2-4","title":"annex 0.2-4","text":"Release candidate testing February 2023 major changes based discussions meeting early February. config object now must contain “unit” variable. allowed variables (see annex_variable_definition()) set pre-defined units must used. annex_prepare() internally converts data ‘annex standard units’. E.g., user can provide temperature data Kelvin Farenheit, annex_prepare() always convert degrees Celsius. currently implemented “T” (temperature; deg C), “RH” (relative humidity; percent) “Pressure” (hPa). Auto-fill “META-Variable” variables annex package enforces unit (e.g., “T” always degrees Celsius; “RH” always percent). Removed “META-Season” sheet XLSX file. Changed aggregation. Originally aggregation done quarterly level including years. new version aggregates year + month. Allowing rooms numbered differenciation adding two digits. E.g. BED, BED1, BED2, BED66 (room types). New functions annex_variable_definition() annex_room_definition() return information allowed variables/room labels amongst information. Added data set containing ISO3166 alpha-3 (ISO3) country codes used validationn. Convenience function annex_countries() returns data(\"ISO3166\") Added quality flag stats; percentage observations falling certain threshold exceed threshold. bounds defined “Definitions” sheet XLSX file can accessed calling annex_variable_definition(). Additional output validating XLSX file; improved readability. Added interval (measurement interval) information stats; time seconds previous observation recorded data set. Calculated varaible level; value present (missing value) considered ‘mesured’ leads longer interval times. Currently reporting five number summary plus XLSX sheets ‘META-Room’ ‘META-Variable’ column optional information measurement location (e.g., next window, center room, important/helpful information) variable (optional meta data). Additional tinytests support functions. Validation: Decent update validation show granular errors warnings. Additional checks specific varaibles ensure content follows expected format. Added conditional tests variables (require additional information).","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-02-0","dir":"Changelog","previous_headings":"","what":"annex 0.2-0","title":"annex 0.2-0","text":"development since January 2, 2023; intended next release initial testing phase December 2022 February 2023. Renaming ‘Pollutant’ consistently ‘Variable’ (issue #2) Renaming sheet ‘Meta-Period’ ‘Meta Season’ (issue #2) Automatically filling ‘Measurement Location’ META-Room (issue #3) Automatically filling ‘Variable Name’ META-Variable (issue #4) Adjusting (internal) function names (Pollutants -> Variables; Period -> Season) given adjustments updates listed .","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-01","dir":"Changelog","previous_headings":"","what":"annex 0.1","title":"annex 0.1","text":"Summary major fixes features development package 0.1-X state. New infrastructure custom S3 class series handy methods Introducing config object easy control Moving project https://github.com/IEA-EBC-Annex86/annex/ Adding first version annex_write_stats(); overwrite mode now Added method reshape annex_stats objects long wirde form vice versa annex_write_stats now accepts long wide formats Added logo (draft) Added annex_validate validate XLSX output file; likely missing checks. Resolving series notes/warnings build check Properly adding licenses (GPL-2 + GPL-3) Updating documentation readme; adding process schematic. Removing unused R scripts (version 0 annex package). Removing rows STAT writing file N == NAs; data available . Rounding stats 4 digits max. Adjusting documentation according GR (0.0-14) Added list contributors; added ORCID GR.","code":""},{"path":"https://some.example-url.com/news/index.html","id":"annex-00-9000","dir":"Changelog","previous_headings":"","what":"Annex 0.0-9000","title":"Annex 0.0-9000","text":"Reto just playing around.","code":""}] diff --git a/docs/sitemap.xml b/docs/sitemap.xml index b92601a..e2d6c2a 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -66,12 +66,18 @@ https://some.example-url.com/reference/annex_countries.html + + https://some.example-url.com/reference/annex_handle_duplicates.html + https://some.example-url.com/reference/annex_parse_formula.html https://some.example-url.com/reference/annex_prepare.html + + https://some.example-url.com/reference/annex_read_stats.html + https://some.example-url.com/reference/annex_room_definition.html diff --git a/inst/tinytest/test_90_minimal.R b/inst/tinytest/test_90_minimal.R index 3ddf440..0986c93 100644 --- a/inst/tinytest/test_90_minimal.R +++ b/inst/tinytest/test_90_minimal.R @@ -29,13 +29,14 @@ annex_check_config(config) # if the `annex_stats` calcs are fine and the mapping with the # config file works as expected. Time: Two periods, once # at night and once during the day (local time) on two differnt -# days with an interval of 30 days to check the interval/Nestim guesses). -# Each period has exactely 5 measurements which will be generated below +# days with an interval of 10 mins to check the interval/Nestim guesses). +# Each period has exactely N = 20 measurements which will be generated below # to thest the calculation of the statistics. The second period is also # set in a way (assuming UTC) to check if the 'tz' conversion works as # expected; summer time; UTC -> CEST +2h -tms <- c(as.POSIXct("2023-12-24 00:00:00", tz = "UTC") + 0:5 * 30 * 60, - as.POSIXct("2023-07-01 05:30:00", tz = "UTC") + 0:5 * 30 * 60) +N <- 20 +tms <- c(as.POSIXct("2023-12-24 00:00:00", tz = "UTC") + (seq_len(N) - 1) * 10 * 60, + as.POSIXct("2023-07-01 05:30:00", tz = "UTC") + (seq_len(N) - 1) * 10 * 60) # All the data we have will be data <- data.frame(timeOfLoggingInUTC = tms) @@ -43,9 +44,10 @@ for (i in seq_len(nrow(config))) { tmp <- as.list(config[i, ]) # Convert to list for convenience if (tmp$variable == "datetime") next # Skipping timeOfLoggingInUTC - # Generate some data; always the "same" such that we can + # Generate some data; always the "same" (uniform sequence from + # seq(10, length.out = N, by = 0.5) such that we can # easily check the calculations later. - values <- rep(0:5 + 1 * 10, 2) + values <- rep(seq(10, length.out = N, by = 0.5), 2) if (tmp$unit == "K") values <- values + 273.15 if (tmp$unit == "%" & tmp$variable == "CO2") values <- values / 1e4 data[[tmp$column]] <- values @@ -93,7 +95,7 @@ expect_warning(prep <- annex_prepare(data, config = config), ## Checking return expect_inherits(prep, "data.frame") -expect_identical(dim(prep), c(60L, 7L)) +expect_identical(dim(prep), c(200L, 7L)) expect_identical(names(prep), c("datetime", "study", "home", "room", "CO2", "T", "RH")) expect_inherits(prep$datetime, "POSIXct") expect_true(all(sapply(subset(prep, select = c(study, room, home)), class) == "character")) @@ -103,7 +105,7 @@ expect_true(all(sapply(subset(prep, select = c(CO2, T, RH)), class) == "numeric" # 10:15 and NA. Check if TRUE. tmp <- unlist(subset(prep, select = c(CO2, T, RH))) tmp <- unique(sort(round(tmp, 10), , na.last = TRUE)) -expect_equal(tmp, c(10:15, NA)) +expect_equal(tmp, c(seq(10, length.out = N, by = 0.5), NA)) # ------------------------------------------------------------------- @@ -115,7 +117,7 @@ expect_message(prep2 <- annex_prepare(data, config = config2), pattern = ".*Columns in `x` not in `config` \\(will be ignored\\).*", info = "Should not process T as not in config") expect_inherits(prep2, "data.frame") -expect_identical(dim(prep2), c(60L, 6L)) +expect_identical(dim(prep2), c(200L, 6L)) expect_identical(names(prep2), c("datetime", "study", "home", "room", "CO2", "RH")) rm(prep2) rm(config2) @@ -130,7 +132,7 @@ expect_silent(annex_df <- annex(T + RH + CO2 ~ datetime | study + home + room, d expect_true("annex_df" %in% ls()) expect_inherits(annex_df, "annex", info = "Checking class of annex object") expect_inherits(annex_df, "data.frame", info = "Checking class of annex object") -expect_identical(dim(annex_df), c(60L, 10L), info = "Dimension of annex object") +expect_identical(dim(annex_df), c(200L, 10L), info = "Dimension of annex object") # Adds a series of new columns, check if we got what we want expect_identical(names(annex_df), @@ -160,7 +162,7 @@ expect_true(all(subset(annex_df, as.Date(annex_df$datetime) != as.Date("2023-07- # The observations should be unchanged and all in 10:15 or NA tmp <- unlist(subset(annex_df, select = c(CO2, T, RH))) tmp <- unique(sort(round(tmp, 10), , na.last = TRUE)) -expect_equal(tmp, c(10:15, NA)) +expect_equal(tmp, c(seq(10, length.out = N, by = 0.5), NA)) @@ -173,33 +175,33 @@ expect_silent(stats <- annex_stats(annex_df)) # My CO2 values are all below lower bound, check if identified properly expect_true(all(subset(stats, variable == "CO2")$quality_lower == 100), info = "Lower bound violation for CO2") -expect_true(all(subset(stats, variable != "CO2")$quality_lower == 0), +expect_true(all(subset(stats, variable != "CO2")$quality_upper == 0), info = "No violation for RH + T") expect_true(all(stats$quality_upper == 0), info = "No upper bound violation for all the data") # Interval (auto-detected), here the most important is the Median # as it is the one we use to calculate the number of expected values. -expect_true(all(stats$interval_Min == 30 * 60)) -expect_true(all(stats$interval_Q1 == 30 * 60)) -expect_true(all(stats$interval_Median == 30 * 60)) +expect_true(all(stats$interval_Min == 10 * 60)) +expect_true(all(stats$interval_Q1 == 10 * 60)) +expect_true(all(stats$interval_Median == 10 * 60)) -expect_true(all(stats$N == 6), info = "We have 6 observations for each row") -expect_true(all(stats$NAs == 0), info = "No missing values") -expect_true(all(stats$NAs == 0), info = "No missing values") +expect_true(all(stats$N == 20), info = "We have 20 observations for each row") +expect_true(all(stats$NAs == 0), info = "No missing values") +expect_true(all(stats$NAs == 0), info = "No missing values") # For 07-23 (16 hours) we expect Nestim == 32 as our interval is 30 min (1800s) # For 23-07 (8 hours) we expect Nestim == 16 # For all (24 hours) we expect Nestim = 48 -expect_true(all(subset(stats, tod == "07-23")$Nestim == 32)) -expect_true(all(subset(stats, tod == "23-07")$Nestim == 16)) -expect_true(all(subset(stats, tod == "all")$Nestim == 48)) +expect_true(all(subset(stats, tod == "07-23")$Nestim == 16 * 6)) +expect_true(all(subset(stats, tod == "23-07")$Nestim == 8 * 6)) +expect_true(all(subset(stats, tod == "all")$Nestim == 24 * 6)) # Due to construction, the rest of the stats is identical # for all variables and all based on 10:15. E.g, the # Mean == mean(10:15) == 12.5. Let's test if the calculations # are correct -tmp <- 10:15 +tmp <- seq(10, length.out = N, by = 0.5) expect_equal(stats$Mean, rep(mean(tmp), nrow(stats)), tolerance = 0.001, info = "Checking calculated mean") @@ -228,19 +230,5 @@ expect_error(annex_write_stats(stats, tmpfile, user = 999, overwrite = FALSE), expect_error(annex_write_stats(stats, tmpfile, user = 999, overwrite = TRUE), info = "Testing overwrite = TRUE") -# Check if it properly validates -#expect_true(annex_validate(tmpfile, user = 999, quiet = TRUE), -# info = "Checking validity of XLSX file") - -# TODO(R): Modify the xlsx file to make it valid, -# check validity, and then test the new annex_read_stats -# function. - - - - - - - diff --git a/inst/tinytest/test_91_duplicate_action.R b/inst/tinytest/test_91_duplicate_action.R index 330dcca..42c0dc0 100644 --- a/inst/tinytest/test_91_duplicate_action.R +++ b/inst/tinytest/test_91_duplicate_action.R @@ -10,25 +10,46 @@ if (interactive()) { # added in annex version 0.2-9+ # Setting up the data set (prepared df; manually) +# Note: We need at least 10 valid observations to be able to calculate +# the stats, thus the latter one are used to 'fill up' the data. data <- " datetime; study; home; room; CO2; T; note -2023-11-03 15:00; test; test; BED1; 500; 25.5; 15:00 has no duplicate -2023-11-03 15:00; test; test; BED2; 400; 18.2; 15:00 has no duplicate -2023-11-03 16:00; test; test; BED1; 520; 24.8; --- -2023-11-03 16:00; test; test; BED2; 434; 18.1; --- -2023-11-03 16:00; test; test; BED1; NA; NA; duplicated 16:00, all missing -2023-11-03 16:00; test; test; BED2; NA; NA; duplicated 16:00, all missing -2023-11-03 17:00; test; test; BED1; 540; 24.7; --- -2023-11-03 17:00; test; test; BED2; 427; 18.0; --- -2023-11-03 17:00; test; test; BED1; NA; 24.7; duplicated 17:00, partially missing -2023-11-03 17:00; test; test; BED2; 427; NA; duplicated 17:00, partially missing -2023-11-03 18:00; test; test; BED1; 535; 25.1; --- -2023-11-03 18:00; test; test; BED2; 413; 18.3; --- -2023-11-03 18:00; test; test; BED1; -535; -25.1; duplicated 18:00, different values (neg) -2023-11-03 18:00; test; test; BED2; -413; -18.3; duplicated 18:00, different values (neg) +2023-11-03 08:00; test; test; BED1; 500; 25.5; 08:00 has no duplicate +2023-11-03 08:00; test; test; BED2; 400; 18.2; 08:00 has no duplicate +2023-11-03 09:00; test; test; BED1; 520; 24.8; --- +2023-11-03 09:00; test; test; BED2; 434; 18.1; --- +2023-11-03 09:00; test; test; BED1; NA; NA; duplicated 09:00, all missing +2023-11-03 09:00; test; test; BED2; NA; NA; duplicated 09:00, all missing +2023-11-03 10:00; test; test; BED1; 540; 24.7; --- +2023-11-03 10:00; test; test; BED2; 427; 18.0; --- +2023-11-03 10:00; test; test; BED1; NA; 24.7; duplicated 10:00, partially missing +2023-11-03 10:00; test; test; BED2; 427; NA; duplicated 10:00, partially missing +2023-11-03 11:00; test; test; BED1; 535; 25.1; --- +2023-11-03 11:00; test; test; BED2; 413; 18.3; --- +2023-11-03 11:00; test; test; BED1; -535; -25.1; duplicated 11:00, different values (neg) +2023-11-03 11:00; test; test; BED2; -413; -18.3; duplicated 11:00, different values (neg) +### Valid data to fill up the data.frame +2023-11-03 12:00; test; test; BED1; 501; 24.1; filler +2023-11-03 12:00; test; test; BED2; 401; 19.1; filler +2023-11-03 13:00; test; test; BED1; 502; 24.2; filler +2023-11-03 13:00; test; test; BED2; 402; 19.2; filler +2023-11-03 14:00; test; test; BED1; 503; 24.3; filler +2023-11-03 14:00; test; test; BED2; 403; 19.3; filler +2023-11-03 15:00; test; test; BED1; 504; 24.4; filler +2023-11-03 15:00; test; test; BED2; 404; 19.4; filler +2023-11-03 16:00; test; test; BED1; 505; 24.5; filler +2023-11-03 16:00; test; test; BED2; 405; 19.5; filler +2023-11-03 17:00; test; test; BED1; 506; 24.6; filler +2023-11-03 17:00; test; test; BED2; 406; 19.6; filler +2023-11-03 18:00; test; test; BED1; 507; 24.7; filler +2023-11-03 18:00; test; test; BED2; 407; 19.7; filler +2023-11-03 19:00; test; test; BED1; 508; 24.8; filler +2023-11-03 19:00; test; test; BED2; 408; 19.8; filler +2023-11-03 20:00; test; test; BED1; 509; 24.9; filler +2023-11-03 20:00; test; test; BED2; 409; 19.9; filler " -data <- read.csv(text = data, sep = ";", header = TRUE, strip.white = TRUE) +data <- read.csv(text = data, sep = ";", header = TRUE, strip.white = TRUE, comment.char = "#") data$datetime <- as.POSIXct(data$datetime, tz = "UTC") @@ -62,8 +83,8 @@ expect_true("stats" %in% ls()) # Make sure object has been created expect_identical(dim(stats), c(12L, 127L), info = "Statistics dimension check") -expect_true(all(stats$N == 7), - info = "Check if N == 7 (counts duplicates)") +expect_true(all(stats$N == 16), + info = "Check if N == 16 (counts duplicates)") expect_true(all(stats$NAs == 1 | stats$NAs == 2), info = "Check count for number of duplicates") @@ -112,8 +133,8 @@ expect_true(all(stats$p00 < 0), # In addition, we should now always have N = 4 and NAs = 0 as # we were able to remove all missing values. -expect_true(all(stats$N == 4), info = "Sample size after aggregating duplicates") -expect_true(all(stats$NAs == 0), info = "Missing values after aggregating duplicates") +expect_true(all(stats$N == 13), info = "Sample size after aggregating duplicates") +expect_true(all(stats$NAs == 0), info = "Missing values after aggregating duplicates") rm(annex_df) rm(stats) diff --git a/inst/tinytest/test_92_smallN.R b/inst/tinytest/test_92_smallN.R index 0e55ac0..77108d2 100644 --- a/inst/tinytest/test_92_smallN.R +++ b/inst/tinytest/test_92_smallN.R @@ -117,7 +117,7 @@ expect_identical(length(idx <- which(stats$N - stats$NAs < 10)), 12L, info = "Find rows where N - NAs < 10") # Find 'inveral_*', 'Nestim', 'Mean', 'Sd' and all 'p*' cols. -cols <- names(stats)[grepl("^(interval_.*|Nestim|Mean|p[0-9\\.]+)$", names(stats))] +cols <- names(stats)[grepl("^(interval_.*|Nestim|Mean|Sd|p[0-9\\.]+)$", names(stats))] expect_identical(length(cols), 114L, info = "Identify columns which should be NA") expect_true(all(is.na(stats[idx, cols])),