Commit 079237dc authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

update readme

parent 8094cf75
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
## Description ## Description
Compute basic statistics on a tbl_friendlyts table:
1. Mean, standard-deviation, IQR. min, max,... Basic information from a tbl_friendlyts data.frame.
2. On different groups: year, month, weekday, hour,minute, second. - Mean, standard-deviation, IQR. min, max,... on different groups: year, month, weekday, hour, minute, second.
- Timeseries of basic information.
- L-moments.
- Plots.
## Installation ## Installation
...@@ -16,13 +18,15 @@ devtools::install_git("https://git.nilu.no/rdiagnosis/basicr.git") ...@@ -16,13 +18,15 @@ devtools::install_git("https://git.nilu.no/rdiagnosis/basicr.git")
``` ```
## Usage ## Usage
### get 'weather' dataset from 'nycflights13' ### Basic analysis on 'weather' from 'nycflights13' package.
#### get dataset
```R ```R
#install.packages("nycflights13") #install.packages("nycflights13")
library(nycflights13) library(nycflights13)
data(weather) data(weather)
# There are some duplicated rows, I assume there were a maximum of 2 stations for each location. # There are some duplicated rows, I assume there were a maximum of 2 stations.
varnames <- setdiff(names(weather), c("year", "month", "day", "hour","time_hour")) varnames <- setdiff(names(weather), c("year", "month", "day", "hour","time_hour"))
dup <- weather %>% select('origin':'hour') %>% duplicated %>% as.numeric dup <- weather %>% select('origin':'hour') %>% duplicated %>% as.numeric
...@@ -34,63 +38,62 @@ tmp <- tmp %>% ...@@ -34,63 +38,62 @@ tmp <- tmp %>%
tidyr::gather('variable', 'value', -c('dup','origin','time_hour')) %>% tidyr::gather('variable', 'value', -c('dup','origin','time_hour')) %>%
tidyr::unite('var_tmp', 'origin','dup','variable') %>% tidyr::unite('var_tmp', 'origin','dup','variable') %>%
tidyr::spread('var_tmp', 'value') tidyr::spread('var_tmp', 'value')
``` ```
### 'weather' as friendlyts #### 'weather' as friendlyts
```R ```R
# 'weather' as friendlyts # 'weather' as friendlyts
# devtools::install_git("https://git.nilu.no/rfriendlyts/friendlyts.git") devtools::install_git("https://git.nilu.no/rfriendlyts/friendlyts.git")
tmp <- friendlyts::friendlyts(df=tmp,date_col="time_hour",date_type="posixlt",tzone="EST") tmp <- friendlyts::friendlyts(df=tmp,date_col="time_hour",date_type="posixlt",tzone="EST")
tmp
``` ```
### Basic analysis. #### Basic analysis.
```R ```R
names(tmp) names(tmp)
# Relative humidity # Relative humidity
res <- basicr::basicr(df=tmp,target="EWR_0_humid") res <- basicr::basic_info(df=tmp,target="EWR_0_humid")
res res
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="YEAR") res <- basicr::basic_info(df=tmp,target="EWR_0_humid",group="YEAR")
res res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="YEAR") basicr::plot_tbl_basic(df=tmp,target="EWR_0_humid",group="YEAR")
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="MONTH") res <- basicr::basic_info(df=tmp,target="EWR_0_humid",group="MONTH")
res res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="MONTH") basicr::plot_tbl_basic(df=tmp,target="EWR_0_humid",group="MONTH")
res <- basicr::basicr(df=tmp,target="NEWR_0_humidO2_7",group="WDAY") res <- basicr::basic_info(df=tmp,target="NEWR_0_humidO2_7",group="WDAY")
res res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="WDAY") basicr::plot_tbl_basic(df=tmp,target="EWR_0_humid",group="WDAY")
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="HOUR") res <- basicr::basic_info(df=tmp,target="EWR_0_humid",group="HOUR")
res res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="HOUR") basicr::plot_tbl_basic(df=tmp,target="EWR_0_humid",group="HOUR")
# temperature # temperature
res <- basicr::basicr(df=tmp,target="EWR_0_temp") res <- basicr::basic_info(df=tmp,target="EWR_0_temp")
res res
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="YEAR") res <- basicr::basic_info(df=tmp,target="EWR_0_temp",group="YEAR")
res res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="YEAR") basicr::plot_tbl_basic(df=tmp,target="EWR_0_temp",group="YEAR")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="MONTH") res <- basicr::basic_info(df=tmp,target="EWR_0_temp",group="MONTH")
res res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="MONTH") basicr::plot_tbl_basic(df=tmp,target="EWR_0_temp",group="MONTH")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="WDAY") res <- basicr::basic_info(df=tmp,target="EWR_0_temp",group="WDAY")
res res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="WDAY") basicr::plot_tbl_basic(df=tmp,target="EWR_0_temp",group="WDAY")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="HOUR") res <- basicr::basic_info(df=tmp,target="EWR_0_temp",group="HOUR")
res res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="HOUR") basicr::plot_tbl_basic(df=tmp,target="EWR_0_temp",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