Skip to content

Commit

Permalink
Merge pull request #16 from KWB-R/save-id-files-as-utf8
Browse files Browse the repository at this point in the history
Save ID csv files in UTF-8 encoding
  • Loading branch information
ma-z-am committed Jul 14, 2023
2 parents f2675ea + 6d2a853 commit a3c987d
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 72 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ jobs:
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install binary version of sf package on Windows
if: runner.os == 'Windows'
run: install.packages("sf", type = "win.binary")
shell: Rscript {0}
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
Expand Down
14 changes: 4 additions & 10 deletions R/get_package_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ get_stormwaterRunoff <- function(
#' @export
#' @importFrom utils read.table
get_spec_runoff <- function(){
read.table(
file = system.file("extdata/Runoff_conc/spec_conc.csv", package = "r2q"),
sep = ";",
dec = ".",
header = T
read_csv_utf8(
file = system.file("extdata/Runoff_conc/spec_conc.csv", package = "r2q")
)
}

Expand All @@ -149,11 +146,8 @@ get_spec_runoff <- function(){
#' @importFrom utils read.table
#'
get_landuse_runoff <- function(){
read.table(
file = system.file("extdata/Runoff_conc/catch_conc.csv", package = "r2q"),
sep = ";",
dec = ".",
header = T
read_csv_utf8(
file = system.file("extdata/Runoff_conc/catch_conc.csv", package = "r2q")
)
}

Expand Down
27 changes: 18 additions & 9 deletions R/helping_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,9 @@ sub_OgRe_to_name <- function(
#' @export
#'
get_subID <- function(){
read.table(
read_csv_utf8(
file = system.file("extdata/IDs/substance_id.csv", package = "r2q"),
sep = ";",
as.is = TRUE,
header = TRUE
as.is = TRUE
)
}

Expand All @@ -228,12 +226,11 @@ get_subID <- function(){
#' @return data.frame with function IDs and additional 1 to 3 characterizations
#' @export
#'
get_functionsID <- function(){
read.table(
get_functionsID <- function()
{
read_csv_utf8(
file = system.file("extdata/IDs/functions_id.csv", package = "r2q"),
sep = ";",
as.is = TRUE,
header = TRUE
as.is = TRUE
)
}

Expand Down Expand Up @@ -297,3 +294,15 @@ massUnit_tranformation <- function(original_unit, change){
df[init_row, 3 + change]
}

# read_csv_utf8 ----------------------------------------------------------------
read_csv_utf8 <- function(file, sep = ";", dec = ".", ...)
{
read.table(
file = file,
sep = sep,
dec = dec,
header = TRUE,
fileEncoding = "UTF-8",
...
)
}
64 changes: 32 additions & 32 deletions inst/extdata/IDs/functions_id.csv
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
f_id;primary_function;char1;char2;char3
1;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Zinkdach;
2;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Gr�ndach;Mit Biozidverwendung / unbekannt
3;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Gr�ndach;Ohne Biozidverwendung
4;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Bitumendach;Mit Biozidverwendung / unbekannt
5;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Bitumendach;Ohne Biozidverwendung
6;Wohngeb�ude;In Verkehrsreichem Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
7;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Zinkdach;
8;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Gr�ndach;Mit Biozidverwendung / unbekannt
9;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Gr�ndach;Ohne Biozidverwendung
10;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Bitumendach;Mit Biozidverwendung / unbekannt
11;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Bitumendach;Ohne Biozidverwendung
12;Wohngeb�ude;In Verkehrsarmen Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
13;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Zinkdach;
14;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Gr�ndach;Mit Biozidverwendung
15;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Gr�ndach;Ohne Biozidverwendung
16;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Bitumendach;Mit Biozidverwendung
17;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Bitumendach;Ohne Biozidverwendung
18;Gewerbe/ Industriegeb�ude ;In Verkehrsreichem Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
19;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Zinkdach;
20;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Gr�ndach;Mit Biozidverwendung
21;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Gr�ndach;Ohne Biozidverwendung
22;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Bitumendach;Mit Biozidverwendung
23;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Bitumendach;Ohne Biozidverwendung
24;Gewerbe/ Industriegeb�ude ;In Verkehrsarmen Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
25;Hoffl�che ;In Verkehrsreichem Gebiet;Fugenlos;
26;Hoffl�che ;In Verkehrsreichem Gebiet;offene Fugen;
27;Hoffl�che ;In Verkehrsarmen Gebiet;Fugenlos;
28;Hoffl�che ;In Verkehrsarmen Gebiet;offene Fugen;
29;Stra�e / Parkplatz(?);Viel befahren;;
30;Stra�e / Parkplatz(?);Mittel befahren;;
31;Stra�e / Parkplatz(?);gering befahren;;
32;Stra�e / Parkplatz(?);kaum befahren;;
1;Wohngebäude;In Verkehrsreichem Gebiet;Mit Zinkdach;
2;Wohngebäude;In Verkehrsreichem Gebiet;Mit Gründach;Mit Biozidverwendung / unbekannt
3;Wohngebäude;In Verkehrsreichem Gebiet;Mit Gründach;Ohne Biozidverwendung
4;Wohngebäude;In Verkehrsreichem Gebiet;Mit Bitumendach;Mit Biozidverwendung / unbekannt
5;Wohngebäude;In Verkehrsreichem Gebiet;Mit Bitumendach;Ohne Biozidverwendung
6;Wohngebäude;In Verkehrsreichem Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
7;Wohngebäude;In Verkehrsarmen Gebiet;Mit Zinkdach;
8;Wohngebäude;In Verkehrsarmen Gebiet;Mit Gründach;Mit Biozidverwendung / unbekannt
9;Wohngebäude;In Verkehrsarmen Gebiet;Mit Gründach;Ohne Biozidverwendung
10;Wohngebäude;In Verkehrsarmen Gebiet;Mit Bitumendach;Mit Biozidverwendung / unbekannt
11;Wohngebäude;In Verkehrsarmen Gebiet;Mit Bitumendach;Ohne Biozidverwendung
12;Wohngebäude;In Verkehrsarmen Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
13;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Zinkdach;
14;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Gründach;Mit Biozidverwendung
15;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Gründach;Ohne Biozidverwendung
16;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Bitumendach;Mit Biozidverwendung
17;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Bitumendach;Ohne Biozidverwendung
18;Gewerbe/ Industriegebäude ;In Verkehrsreichem Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
19;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Zinkdach;
20;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Gründach;Mit Biozidverwendung
21;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Gründach;Ohne Biozidverwendung
22;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Bitumendach;Mit Biozidverwendung
23;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Bitumendach;Ohne Biozidverwendung
24;Gewerbe/ Industriegebäude ;In Verkehrsarmen Gebiet;Mit Ziegel-, Glas- und sonstiges Metalldach, etc.;
25;Hoffläche ;In Verkehrsreichem Gebiet;Fugenlos;
26;Hoffläche ;In Verkehrsreichem Gebiet;offene Fugen;
27;Hoffläche ;In Verkehrsarmen Gebiet;Fugenlos;
28;Hoffläche ;In Verkehrsarmen Gebiet;offene Fugen;
29;Straße / Parkplatz(?);Viel befahren;;
30;Straße / Parkplatz(?);Mittel befahren;;
31;Straße / Parkplatz(?);gering befahren;;
32;Straße / Parkplatz(?);kaum befahren;;
12 changes: 6 additions & 6 deletions inst/extdata/IDs/substance_id.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
s_id;substance;name_OgRe;name_de;name_en;group_de;group_en
1;AFS_63;AFS fein (<63�m);AFS (<63�m);AFS (<63�m);AFS;suspended_solids
1;AFS_63;AFS fein (<63µm);AFS (<63µm);AFS (<63µm);AFS;suspended_solids
2;Anthracen;Anthracen;Anthracen;Anthracene;PAK;PAH
3;Benzo_a_pyren;Benzo[a]pyren;Benzo(a)pyren;Benzo(a)pyrene;PAK;PAH
4;Benzo_b_fluoranthen;Benzo[b]fluoranthen;Benzo(b)fluoranthen;Benzo(b)fluoranthene;PAK;PAH
5;Benzo_g,h,i_perylen;Benzo[g,h,i]perylen;Benzo(g,h,i)perylen;Benzo(g,h,i)perylene;PAK;PAH
6;Benzo_k_fluoranthen;Benzo[k]fluoranthen;Benzo(k)fluoranthen;Benzo(k)fluoranthene;PAK;PAH
7;Pb_geloest;Blei gel�st;Pb (gel.);Pb (diss);Schwermetalle;Heavy_metals
8;Cd_geloest;Cadmium gel�st;Cd (gel.);Cd (diss);Schwermetalle;Heavy_metals
7;Pb_geloest;Blei gelöst;Pb (gel.);Pb (diss);Schwermetalle;Heavy_metals
8;Cd_geloest;Cadmium gelöst;Cd (gel.);Cd (diss);Schwermetalle;Heavy_metals
9;Carbendazim;Carbendazim;Carbendazim;Carbendazim;Biozide;Biocides
10;Diethylhexylphthalat;Diethylhexylphthalat (DEHP);Diethylhexylphthalat;Diethylhexyl phthalate;Phthalat;Phthalate
11;Diuron;Diuron;Diuron;Diuron;Biozide;Biocides
12;Fluoranthen;Fluoranthen;Fluoranthen;Fluoranthene;PAK;PAH
13;Gesamt_Phosphor;Gesamt-Phosphor;Gesamt Phosphor;Total Phosphorus;Naehrstoffe;Nutrients
14;Kupfer_geloest;Kupfer gel�st;Cu (gel.);Cu (diss);Schwermetalle;Heavy_metals
14;Kupfer_geloest;Kupfer gelöst;Cu (gel.);Cu (diss);Schwermetalle;Heavy_metals
15;Mecoprop;Mecoprop;Mecoprop;Mecoprop;Biozide;Biocides
16;Naphthalin;Naphthalin;Naphthalin;Naphthalene;PAK;PAH
17;Nickel_geloest;Nickel gel�st;Ni (gel.);Ni (diss);Schwermetalle;Heavy_metals
17;Nickel_geloest;Nickel gelöst;Ni (gel.);Ni (diss);Schwermetalle;Heavy_metals
18;Orthophosphat;Orthophosphat;Orthophosphat;Orthophosphate;Naehrstoffe;Nutrients
19;Phenanthren;Phenanthren;Phenanthren;Phenanthrene;PAK;PAH
20;Terbutryn;Terbutryn;Terbutryn;Terbutryn;Biozide;Biocides
21;Zink_geloest;Zink gel�st;Zn (gel.);Zn (diss);Schwermetalle;Heavy_metals
21;Zink_geloest;Zink gelöst;Zn (gel.);Zn (diss);Schwermetalle;Heavy_metals
12 changes: 6 additions & 6 deletions inst/extdata/Runoff_conc/catch_conc.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Substance;Unit;residential_suburban_med;residential_suburban_q95;residential_city_med;residential_city_q95;commercial_med;commercial_q95;main_road_med;main_road_q95
AFS fein (<63�m);mg/L;26;100;26;100;26;100;26;100
AFS fein (<63µm);mg/L;26;100;26;100;26;100;26;100
Anthracen;ug/L;0.01;0.024;0.016;0.11;0.02;0.054;0.056;0.18
Benzo[a]pyren;ug/L;0.012;0.083;0.034;0.34;0.05;0.18;0.16;0.59
Benzo[b]fluoranthen;ug/L;0.057;0.16;0.098;0.43;0.16;0.34;0.34;0.61
Benzo[g,h,i]perylen;ug/L;0.013;0.07;0.025;0.22;0.044;0.15;0.11;0.31
Benzo[k]fluoranthen;ug/L;0.01;0.057;0.022;0.21;0.032;0.2;0.11;0.46
Blei gel�st;ug/L;2.1;4.2;1;3.2;3.8;15;0.59;1.2
Cadmium gel�st;ug/L;0.05;0.1;0.05;0.054;0.32;0.71;0.05;0.1
Blei gelöst;ug/L;2.1;4.2;1;3.2;3.8;15;0.59;1.2
Cadmium gelöst;ug/L;0.05;0.1;0.05;0.054;0.32;0.71;0.05;0.1
Carbendazim;ug/L;0.065;0.4;0.04;0.97;0.045;0.1;0.02;0.057
Diethylhexylphthalat (DEHP);ug/L;0.52;2;0.69;2.4;1.6;3.7;2;11
Diuron;ug/L;0.065;0.21;0.03;0.5;0.03;0.077;0.03;0.2
Fluoranthen;ug/L;0.081;0.32;0.18;1.4;0.34;0.98;0.76;2.9
Gesamt-Phosphor;mg/L;0.45;1.1;0.36;0.96;0.22;0.76;0.58;1.8
Kupfer gel�st;ug/L;50;100;14;61;110;150;14;28
Kupfer gelöst;ug/L;50;100;14;61;110;150;14;28
Mecoprop;ug/L;0.2;1.3;0.44;2.1;0.16;0.98;0.02;0.02
Naphthalin;ug/L;0.05;0.05;0.05;0.05;0.05;0.05;0.05;0.055
Nickel gel�st;ug/L;1.6;3.2;1;1.9;2.3;5.3;2.3;7.4
Nickel gelöst;ug/L;1.6;3.2;1;1.9;2.3;5.3;2.3;7.4
Orthophosphat;mg/L;0.14;0.43;0.04;0.22;0.03;0.21;0.04;0.084
Phenanthren;ug/L;0.037;0.13;0.095;0.52;0.12;0.31;0.29;0.67
Terbutryn;ug/L;0.08;0.24;0.035;0.15;0.035;0.06;0.01;0.03
Zink gel�st;ug/L;200;400;270;550;960;2500;100;200
Zink gelöst;ug/L;200;400;270;550;960;2500;100;200
18 changes: 9 additions & 9 deletions inst/extdata/Runoff_conc/spec_conc.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
s_id;unit;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32
4;�g/L;0.17;0.017;0.017;0.17;0.17;0.17;0.025;0.017;0.017;0.025;0.025;0.025;0.17;0.017;0.017;0.17;0.17;0.17;0.025;0.017;0.017;0.025;0.025;0.025;0.17;0.17;0.025;0.025;0.34;0.29;0.15;0
5;�g/L;0.075;0.0082;0.0082;0.075;0.075;0.075;0;0;0;0;0;0;0.075;0.0082;0.0082;0.075;0.075;0.075;0;0;0;0;0;0;0.075;0.075;0;0;0.13;0.11;0.054;0
6;�g/L;0.06;0.017;0.017;0.06;0.06;0.06;0;0;0;0;0;0;0.06;0.017;0.017;0.06;0.06;0.06;0;0;0;0;0;0;0.06;0.06;0;0;0.157;0.127;0.051;0
12;�g/L;0.395;0.12;0.12;0.395;0.395;0.395;0;0;0;0;0;0;0.395;0.12;0.12;0.395;0.395;0.395;0;0;0;0;0;0;0.395;0.395;0;0;1.02;0.83;0.35;0
s_id;unit;X1;X2;X3;X4;X5;X6;X7;X8;X9;X10;X11;X12;X13;X14;X15;X16;X17;X18;X19;X20;X21;X22;X23;X24;X25;X26;X27;X28;X29;X30;X31;X32
4;µg/L;0.17;0.017;0.017;0.17;0.17;0.17;0.025;0.017;0.017;0.025;0.025;0.025;0.17;0.017;0.017;0.17;0.17;0.17;0.025;0.017;0.017;0.025;0.025;0.025;0.17;0.17;0.025;0.025;0.34;0.29;0.15;0
5;µg/L;0.075;0.0082;0.0082;0.075;0.075;0.075;0;0;0;0;0;0;0.075;0.0082;0.0082;0.075;0.075;0.075;0;0;0;0;0;0;0.075;0.075;0;0;0.13;0.11;0.054;0
6;µg/L;0.06;0.017;0.017;0.06;0.06;0.06;0;0;0;0;0;0;0.06;0.017;0.017;0.06;0.06;0.06;0;0;0;0;0;0;0.06;0.06;0;0;0.157;0.127;0.051;0
12;µg/L;0.395;0.12;0.12;0.395;0.395;0.395;0;0;0;0;0;0;0.395;0.12;0.12;0.395;0.395;0.395;0;0;0;0;0;0;0.395;0.395;0;0;1.02;0.83;0.35;0
13;mg/L;0;0.1;0.1;0;0;0;0;0.1;0.1;0;0;0;0;0.1;0.1;0;0;0;0;0.1;0.1;0;0;0;0;0;0;0;0.094;0.25;1.9;1.9
18;mg/L;0;0.05;0.05;0;0;0;0;0.05;0.05;0;0;0;0;0.05;0.05;0;0;0;0;0.05;0.05;0;0;0;0;0;0;0;0.044;0.125;0.78;0.78
21;�g/L;7000;55;55;55;55;55;7000;55;55;55;55;55;7000;0;0;0;0;0;7000;0;0;0;0;0;41;41;41;41;109;109;109;109
14;�g/L;39;39;39;39;39;39;39;39;39;39;39;39;106;106;106;106;106;106;106;106;106;106;106;106;56;56;56;56;14.6;14.6;14.6;14.6
15;�g/L;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;0;0;0;0;0;0;0
10;�g/L;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;0.97;0.97;0.97;0.97;1.02;0.83;0.35;0
21;µg/L;7000;55;55;55;55;55;7000;55;55;55;55;55;7000;0;0;0;0;0;7000;0;0;0;0;0;41;41;41;41;109;109;109;109
14;µg/L;39;39;39;39;39;39;39;39;39;39;39;39;106;106;106;106;106;106;106;106;106;106;106;106;56;56;56;56;14.6;14.6;14.6;14.6
15;µg/L;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;1.9;0;1.9;0;0;0;0;0;0;0;0;0;0
10;µg/L;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;0.58;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;2.12;0.97;0.97;0.97;0.97;1.02;0.83;0.35;0
1;mg/L;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;75;75;75;75

0 comments on commit a3c987d

Please sign in to comment.