Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rdiagnosis
basicr
Commits
88e6c408
Commit
88e6c408
authored
Feb 11, 2021
by
Jean-Marie Lepioufle
Browse files
typo
parent
3e297845
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/plot_tbl_basic.R
View file @
88e6c408
...
...
@@ -36,13 +36,13 @@ plot_tbl_basic <- function(x,target,group,path=tempdir(),name=NULL,DESKTOP=TRUE,
names
(
x
)[
names
(
x
)
==
target
]
<-
"targ"
p
<-
switch
(
group
,
"YEAR"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
YEAR
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"MONTH"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MONTH
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"WDAY"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
WDAY
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"DAY"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
DAY
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"HOUR"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
HOUR
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"MINUTE"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MINUTE
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"SECOND"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
SECOND
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
y_name
),
"YEAR"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
YEAR
,
y
=
targ
,
group
=
YEAR
))
+
ggplot2
::
labs
(
x
=
"YEAR"
,
y
=
y_name
),
"MONTH"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MONTH
,
y
=
targ
,
group
=
MONTH
))
+
ggplot2
::
labs
(
x
=
"MONTH"
,
y
=
y_name
),
"WDAY"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
WDAY
,
y
=
targ
,
group
=
WDAY
))
+
ggplot2
::
labs
(
x
=
"WDAY"
,
y
=
y_name
),
"DAY"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
DAY
,
y
=
targ
,
group
=
DAY
))
+
ggplot2
::
labs
(
x
=
"DAY"
,
y
=
y_name
),
"HOUR"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
HOUR
,
y
=
targ
,
group
=
HOUR
))
+
ggplot2
::
labs
(
x
=
"HOUR"
,
y
=
y_name
),
"MINUTE"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MINUTE
,
y
=
targ
,
group
=
MINUTE
))
+
ggplot2
::
labs
(
x
=
"MINUTE"
,
y
=
y_name
),
"SECOND"
=
ggplot2
::
ggplot
(
x
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
SECOND
,
y
=
targ
,
group
=
SECOND
))
+
ggplot2
::
labs
(
x
=
"SECOND"
,
y
=
y_name
),
stop
(
"group not recognized"
))
print
(
p
)
...
...
vignettes/basicr_on_data.luftkval.oslo10.Rmd
View file @
88e6c408
...
...
@@ -18,7 +18,7 @@ knitr::opts_chunk$set(collapse = T, comment = "#>")
### Get 'data.luftkval.oslo10' dataset.
```R
library(dplyr)
fromDate <- "2015/01/01 00:00:00"
toDate <- "2018/12/31 23:00:00"
timeResolution <- "hourly"
...
...
@@ -27,7 +27,8 @@ precision <- "hourly"
element_id <- c("NO2")
# station ids
station_id <- c("7","848","827","665","9","11","163","504","809")
#station_id <- c("7","848","827","665","9","11","163","504","809")
station_id <- c("7","464","827","665","9","11","163","504","809")
# luft
...
...
@@ -64,6 +65,8 @@ cond <- paste(qa_all, "%in%", known_ok,collapse=" & ")
study <- study %>% filter(eval(parse(text=cond))) %>% select(c("WDAY","YEAR","MONTH","DAY","HOUR"),tidyselect::all_of(all),tidyselect::all_of(qa_all)) %>% friendlyts::as_tbl_friendlyts(precision=precision,date_type="friendlyts",CHECKNAS=FALSE)
study <- stats::na.omit(study)
write.csv(study,file="~/NO2_oslo10_2015_2018.csv")
```
### Missing values
...
...
@@ -120,6 +123,7 @@ basicr::plot_lmrd(x=res,DESKTOP=FALSE,path="~")
#res <- lapply(paste0(element_id,"_","7"),function(x){basicr::basic_info(df=study,target=x,group=c("WDAY"))})
#res <- lapply(paste0(element_id,"_","7"),function(x){basicr::basic_info(df=study,target=x,group=c("HOUR"))})
res <- lapply(paste0(element_id,"_","7"),function(x){basicr::basic_info(df=study,target=x,group=c("WDAY","HOUR"))})
#res <- lapply(paste0(element_id,"_","7"),function(x){basicr::basic_info(df=study,target=x,group=c("MONTH","WDAY","HOUR"))})
res <- do.call("rbind",res)
basicr::plot_lmrd(x=res,DESKTOP=FALSE,path="~")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment