Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PvSTATEM R Pipeline
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas OBADIA
PvSTATEM R Pipeline
Commits
3b4b5a16
Commit
3b4b5a16
authored
4 months ago
by
Thomas OBADIA
💬
Browse files
Options
Downloads
Patches
Plain Diff
Add QC checks for data consistency comparing INV and OBS datasets.
parent
a1cc05ad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
02_OBSERVATIONAL/OBSERVATIONAL_03_QC_02_merging_observational_and_inventory_data_integrity.R
+39
-4
39 additions, 4 deletions
...C_02_merging_observational_and_inventory_data_integrity.R
PvSTATEM R Pipeline.Rproj
+1
-0
1 addition, 0 deletions
PvSTATEM R Pipeline.Rproj
with
40 additions
and
4 deletions
02_OBSERVATIONAL/OBSERVATIONAL_03_QC_02_merging_observational_and_inventory_data_integrity.R
+
39
−
4
View file @
3b4b5a16
...
...
@@ -134,8 +134,31 @@ print(OBSERVATIONAL_OUT_03_QC_02_PLOT_SEX_01)
######################################################################
### DEMOGRAPHICS CONSISTENCY: AGE / PLOT
######################################################################
## Contingency table
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_01
<-
ggplot
(
dat_observational_inventory_demographics_fulljoin
%>%
count
(
country
,
agey_obs_inv_match
),
aes
(
x
=
agey_obs_inv_match
,
y
=
country
))
+
geom_tile
(
aes
(
fill
=
agey_obs_inv_match
),
color
=
"#000000FF"
,
show.legend
=
FALSE
)
+
geom_text
(
aes
(
label
=
n
))
+
labs
(
x
=
"Agreement between INVENTORY and OBSERVATIONAL phase"
,
y
=
"Country"
)
+
scale_fill_manual
(
values
=
c
(
"TRUE"
=
"#00FF007F"
,
"FALSE"
=
"#FF00007F"
),
na.value
=
"#D3D3D37F"
,
guide
=
"none"
)
+
theme_bw
()
+
theme
(
legend.position
=
"bottom"
)
print
(
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_01
)
## Scatterplot
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
1
<-
ggplot
(
dat_observational_inventory_demographics_fulljoin
,
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
2
<-
ggplot
(
dat_observational_inventory_demographics_fulljoin
,
aes
(
x
=
agey.inv
,
y
=
agey.obs
))
+
geom_point
(
aes
(
color
=
agey_obs_inv_match
))
+
...
...
@@ -153,10 +176,10 @@ OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_01 <- ggplot(dat_observational_inventory_de
theme_bw
()
+
theme
(
legend.position
=
"bottom"
)
print
(
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
1
)
print
(
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
2
)
## Histogram
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
2
<-
ggplot
(
dat_observational_inventory_demographics_fulljoin
,
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
3
<-
ggplot
(
dat_observational_inventory_demographics_fulljoin
,
aes
(
x
=
agey.obs
-
agey.inv
))
+
geom_histogram
(
aes
(
fill
=
agey_obs_inv_match
),
binwidth
=
1
)
+
geom_vline
(
xintercept
=
ACCEPTABLE_DIFF_AGEY_OBS_MINUS_INV_MAX
,
...
...
@@ -182,7 +205,7 @@ OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_02 <- ggplot(dat_observational_inventory_de
theme_bw
()
+
theme
(
legend.position
=
"bottom"
)
print
(
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
2
)
print
(
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_0
3
)
...
...
@@ -219,6 +242,12 @@ OBSERVATIONAL_OUT_03_QC_02_PLOTNAME_AGEY_02 <- paste0("OBSERVATIONAL_OUT_03_QC_0
"_timestamp-"
,
strftime
(
Sys.time
(),
format
=
"%Y%m%d_%H%M%S"
),
".pdf"
)
OBSERVATIONAL_OUT_03_QC_02_PLOTNAME_AGEY_03
<-
paste0
(
"OBSERVATIONAL_OUT_03_QC_02_AGEY_PLOT_03"
,
"_country-"
,
paste
(
unique
(
dat_observational_inventory_demographics_fulljoin
$
country
),
collapse
=
"-"
),
"_timestamp-"
,
strftime
(
Sys.time
(),
format
=
"%Y%m%d_%H%M%S"
),
".pdf"
)
## Write to output files
# The graphs
...
...
@@ -240,6 +269,12 @@ ggsave(filename = OBSERVATIONAL_OUT_03_QC_02_PLOTNAME_AGEY_02,
width
=
8
,
height
=
8
)
ggsave
(
filename
=
OBSERVATIONAL_OUT_03_QC_02_PLOTNAME_AGEY_03
,
path
=
"02_OBSERVATIONAL/outputs/"
,
plot
=
OBSERVATIONAL_OUT_03_QC_02_PLOT_AGEY_03
,
width
=
8
,
height
=
8
)
# The data
write.table
(
dat_observational_inventory_demographics_fulljoin
,
file
=
paste0
(
"./02_OBSERVATIONAL/outputs/"
,
...
...
This diff is collapsed.
Click to expand it.
PvSTATEM R Pipeline.Rproj
+
1
−
0
View file @
3b4b5a16
Version: 1.0
ProjectId: 37109f91-1530-42f3-b3fe-656347abd584
RestoreWorkspace: Default
SaveWorkspace: Default
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment