Commit d78e5fe4 authored by jml's avatar jml
Browse files

update readme

parent 75dfd46a
......@@ -2,20 +2,95 @@
## Description
The package make easy basic statistics on tbl_friendlyts object.
1. n, mean, standard-deviation, IQR, min, max,...
2. On different groups: hour,wday, month
Compute basic statistics on a tbl_friendlyts table:
## Prerequisite
1. Mean, standard-deviation, IQR. min, max,...
2. On different groups: year, month, weekday, hour,minute, second.
## Installation
Install the "remotes" R-package
```R
source("https://raw.githubusercontent.com/r-lib/remotes/master/install-github.R")$value("r-lib/remotes")
library("devtools")
devtools::install_git("https://git.nilu.no/rdiagnosis/basicr.git")
```
## Usage
## Installation
### get 'weather' dataset from 'nycflights13'
```R
#install.packages("nycflights13")
library(nycflights13)
data(weather)
# There are some duplicated rows, I assume there were a maximum of 2 stations for each location.
varnames <- setdiff(names(weather), c("year", "month", "day", "hour","time_hour"))
dup <- weather %>% select('origin':'hour') %>% duplicated %>% as.numeric
# keep time_hour as the only column related to date and time
tmp <- weather %>% mutate(dup=dup) %>% select('time_hour','dup',varnames)
tmp <- tmp %>%
tidyr::gather('variable', 'value', -c('dup','origin','time_hour')) %>%
tidyr::unite('var_tmp', 'origin','dup','variable') %>%
tidyr::spread('var_tmp', 'value')
```
### 'weather' as friendlyts
```R
library("remotes")
remotes::install_git("git@git.nilu.no:rdiagnosis/basicr.git")
# 'weather' as friendlyts
# 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
```
### Basic analysis.
```R
names(tmp)
# Relative humidity
res <- basicr::basicr(df=tmp,target="EWR_0_humid")
res
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="YEAR")
res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="YEAR")
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="MONTH")
res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="MONTH")
res <- basicr::basicr(df=tmp,target="NEWR_0_humidO2_7",group="WDAY")
res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="WDAY")
res <- basicr::basicr(df=tmp,target="EWR_0_humid",group="HOUR")
res
plot_tbl_basic(df=tmp,target="EWR_0_humid",group="HOUR")
# temperature
res <- basicr::basicr(df=tmp,target="EWR_0_temp")
res
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="YEAR")
res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="YEAR")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="MONTH")
res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="MONTH")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="WDAY")
res
plot_tbl_basic(df=tmp,target="EWR_0_temp",group="WDAY")
res <- basicr::basicr(df=tmp,target="EWR_0_temp",group="HOUR")
res
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