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
079237dc
Commit
079237dc
authored
Jan 31, 2019
by
Jean-Marie Lepioufle
Browse files
update readme
parent
8094cf75
Changes
1
Show whitespace changes
Inline
Side-by-side
README.md
View file @
079237dc
...
...
@@ -2,10 +2,12 @@
## Description
Compute basic statistics on a tbl_friendlyts table:
1.
Mean, standard-deviation, IQR. min, max,...
2.
On different groups: year, month, weekday, hour,minute, second.
Basic information from a tbl_friendlyts data.frame.
-
Mean, standard-deviation, IQR. min, max,... on different groups: year, month, weekday, hour, minute, second.
-
Timeseries of basic information.
-
L-moments.
-
Plots.
## Installation
...
...
@@ -16,13 +18,15 @@ devtools::install_git("https://git.nilu.no/rdiagnosis/basicr.git")
```
## Usage
### get 'weather' dataset from 'nycflights13'
### Basic analysis on 'weather' from 'nycflights13' package.
#### get dataset
```
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
.
# 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"
))
dup
<-
weather
%>%
select
(
'origin'
:
'hour'
)
%>%
duplicated
%>%
as.numeric
...
...
@@ -34,63 +38,62 @@ 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
###
#
'weather' as friendlyts
```
R
# '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
```
### Basic analysis.
#### Basic analysis.
```
R
names
(
tmp
)
# Relative humidity
res
<-
basicr
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_humid"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_humid"
)
res
res
<-
basicr
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"YEAR"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"YEAR"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"MONTH"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"MONTH"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"NEWR_0_humidO2_7"
,
group
=
"WDAY"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"NEWR_0_humidO2_7"
,
group
=
"WDAY"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"HOUR"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_humid"
,
group
=
"HOUR"
)
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
res
<-
basicr
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_temp"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_temp"
)
res
res
<-
basicr
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"YEAR"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"YEAR"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"MONTH"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"MONTH"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"WDAY"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"WDAY"
)
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
::
basic
r
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"HOUR"
)
res
<-
basicr
::
basic
_info
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"HOUR"
)
res
plot_tbl_basic
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"HOUR"
)
basicr
::
plot_tbl_basic
(
df
=
tmp
,
target
=
"EWR_0_temp"
,
group
=
"HOUR"
)
```
Write
Preview
Supports
Markdown
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