-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathreport_rwl_corr.rmd
More file actions
137 lines (114 loc) · 3.89 KB
/
report_rwl_corr.rmd
File metadata and controls
137 lines (114 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
title: "Report: Correlations between Series"
output: html_document
params:
fileName: NA
crsObject: NA
crsParams: NA
---
```{r,echo=FALSE}
library(DT)
library(knitr)
library(kableExtra)
crsObject <- params$crsObject
crsParams <- params$crsParams
```
```{r,echo=FALSE}
if(is.null(params$fileName)){
fname <- "DemoData.rwl"
}
if(!is.null(params$fileName)){
fname <- params$fileName
}
```
### Date: `r Sys.Date()`
### File: `r fname`
#### Arguments:
```{r,echo=FALSE}
tab1 <- data.frame(Parameter=c("seg.length","bin.floor","n",
"prewhiten","pcrit","biweight","method"),
Value=c(crsObject$seg.length,crsParams$bin.floor,
crsParams$n, crsParams$prewhiten,
crsParams$pcrit, crsParams$biweight,
crsParams$method))
kable(tab1) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
```
```{r,echo=FALSE, fig.width=10, fig.height=8}
plot(crsObject)
```
<div style = "width:80%; height:auto; margin: auto;">
```{r,echo=FALSE}
overallCor <- round(crsObject$overall,3)
res <- data.frame(Series=rownames(overallCor),
Correlation=overallCor[,1])
datatable(res,rownames = FALSE,
caption = "Overall Series Correlation",
autoHideNavigation=TRUE,
options = list(pageLength = nrow(res),
searching=FALSE,
lengthChange=FALSE)) %>%
formatStyle('Correlation',
fontWeight = styleInterval(crsObject$pcrit, c('normal', 'bold')))
```
```{r,echo=FALSE}
binNames <- paste(crsObject$bins[,1], "-", crsObject$bins[,2], sep="")
res <- data.frame(series=binNames,round(crsObject$avg.seg.rho,3))
colnames(res) <- c("Bin","Correlation")
datatable(res,rownames = FALSE,
caption = "Avg. Correlation by Bin",
autoHideNavigation=TRUE,
options = list(pageLength = min(30,nrow(res)),
searching=FALSE,
lengthChange=FALSE)) %>%
formatStyle('Correlation',
fontWeight = styleInterval(crsObject$pcrit, c('normal', 'bold')))
```
```{r,echo=FALSE}
flags <- crsObject$flags
flagsLogical <- length(flags) == 0
```
</div>
`r if(flagsLogical){"There are no flagged Series / Segments"}`
```{r,echo=FALSE}
if(!flagsLogical){
flags <- unlist(flags)
flagsDF <- data.frame(Series=names(flags),
Bins=gsub(pattern = "\\.",
replacement = "-",
x = flags))
kable(flagsDF,row.names = FALSE, caption = "Flagged Series and Segments")
}
```
```{r,echo=FALSE}
binNames <- paste(crsObject$bins[,1], "-", crsObject$bins[,2], sep="")
res <- round(crsObject$spearman.rho,3)
res <- data.frame(series=rownames(res),res)
colnames(res) <- c("Series",binNames)
datatable(res,rownames = FALSE,
caption = "Series Correlation by Bin",
autoHideNavigation=TRUE,
options = list(pageLength = min(30,nrow(res)),
searching=TRUE,
lengthChange=FALSE)) %>%
formatStyle(columns=-1,
fontWeight = styleInterval(crsObject$pcrit, c('normal', 'bold')))
```
### R Code
```
library(dplR)
dat <- read.rwl("`r fname`")
crs <- corr.rwl.seg(dat,
seg.length = `r crsObject$seg.length`,
bin.floor = `r crsParams$bin.floor`,
n = `r crsParams$n`,
prewhiten = `r crsParams$prewhiten`,
pcrit = `r crsParams$pcrit`,
biweight = `r crsParams$biweight`,
method = "`r crsParams$method`",
make.plot=TRUE)
# data in the tables above are available in the
# crs object via the list elements. e.g.
str(crs)
crs$overall
```