Commit 6bf19997 authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

use of every function in the package

parent b8d9d12a
......@@ -46,39 +46,52 @@ luft <- friendlyr::ts(service="d.luft.oslyr",
fromDate=fromDate,toDate=toDate,precision=timeResolution,timeResolution=timeResolution,
element_id=element_id,station_id=station_id)
# filter -9900 values, used as NA
# filter negatives values, used as NA
varnames <- setdiff(names(luft), friendlyts::get_name_date_col(precision))
library(dplyr)
library(tidyr)
tmp <- luft %>% select(names(luft)) %>%
tidyr::gather(variable, value, -c(friendlyts::get_name_date_col(precision))) %>%
dplyr::mutate(value = replace(value, value == -9900, NA)) %>%
tidyr::spread(variable, value) %>% friendlyts::as_tbl_friendlyts(precision=precision,date_type="friendlyts")
gather(variable, value, -c(friendlyts::get_name_date_col(precision))) %>%
mutate(value = replace(value, value < 0, NA)) %>%
spread(variable, value) %>% friendlyts::as_tbl_friendlyts(precision=precision,date_type="friendlyts")
```
### Basic analysis.
### basics characteristics
```R
names(tmp)
basicr::basic_info(df=tmp,target="NO2_7",group="none")
basicr::basic_info(df=tmp,target="NO2_7",group="YEAR")
basicr::basic_info(df=tmp,target="NO2_7",group="MONTH")
basicr::basic_info(df=tmp,target="NO2_7",group="WDAY")
basicr::basic_info(df=tmp,target="NO2_7",group="HOUR")
basicr::basic_info(df=tmp,target="NO2_7",group=c("YEAR","MONTH"))
res <- basicr::basic_info(df=tmp,target="NO2_7",group=c("MONTH","WDAY","HOUR"))
res <- basicr::basicr(df=tmp,target="NO2_7")
res
basicr::plot_tbl_basic(tmp,target="NO2_7",group="HOUR",y_name="[ug/m3]")
basicr::plot_tbl_basic(tmp,target="NO2_7",group="WDAY",y_name="[ug/m3]")
basicr::plot_tbl_basic(tmp,target="NO2_7",group="MONTH",y_name="[ug/m3]")
res <- basicr::basicr(df=tmp,target="NO2_7",group="YEAR")
res
plot_tbl_basic(df=tmp,target="NO2_7",group="YEAR")
```
### Timeseries of basic characteristics and box-whisker timeseries plot with observation timeseries
```R
res <- basicr::basic_ts(df=tmp,target="NO2_7",group=c("WDAY","HOUR"),precision="hourly")
basicr::plot_boxwhisk_ts(x=res,fromDate="2004/01/05 00:00:00",toDate="2004/01/06 00:00:00",timeResolution="hourly",DESKTOP=TRUE)
```
### L-moment
```R
res <- basicr::basicr(df=tmp,target="NO2_7",group="MONTH")
res
plot_tbl_basic(df=tmp,target="NO2_7",group="MONTH")
lmom_ <- basicr::samlmu2(df=tmp,target=varnames)
res <- basicr::basicr(df=tmp,target="NO2_7",group="WDAY")
res
plot_tbl_basic(df=tmp,target="NO2_7",group="WDAY")
basicr::plot_lmrd(x=lmom_,DESKTOP=TRUE)
res <- basicr::basicr(df=tmp,target="NO2_7",group="HOUR")
res
plot_tbl_basic(df=tmp,target="NO2_7",group="HOUR")
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment