Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IEAtoolsMOVEDTOGITHUB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Otto, Dr. Saskia
IEAtoolsMOVEDTOGITHUB
Commits
fee08f8e
Commit
fee08f8e
authored
4 years ago
by
Otto, Dr. Saskia
Browse files
Options
Downloads
Patches
Plain Diff
added the panel helper functions
parent
1fb02b8a
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
NAMESPACE
+1
-0
1 addition, 0 deletions
NAMESPACE
R/panel_cor.R
+44
-0
44 additions, 0 deletions
R/panel_cor.R
man/panel_cor.Rd
+33
-0
33 additions, 0 deletions
man/panel_cor.Rd
man/trafficlight.Rd
+1
-1
1 addition, 1 deletion
man/trafficlight.Rd
with
79 additions
and
1 deletion
NAMESPACE
+
1
−
0
View file @
fee08f8e
...
...
@@ -4,6 +4,7 @@ export("%>%")
export(calc_vif)
export(explore_na)
export(impute)
export(panel_cor)
export(plot_statespace_ch)
export(plot_statespace_ed)
export(statespace_ch)
...
...
This diff is collapsed.
Click to expand it.
R/panel_cor.R
0 → 100644
+
44
−
0
View file @
fee08f8e
#' Show correlation coefficient in pairs plot
#'
#' This and the other functions are utility functions for the pairs plot.
#' \code{panel_cor} shows the Pearson product-moment correlation coefficient in
#' the selected panels. \code{panel_lines} shows the regression line and
#' \code{panel_hist} histograms.
#'
#' @param x numeric vector
#' @param y numeric vector
#' @seealso \code{\link{pairs}}
#' @export
#' @examples
#' z <- matrix(rnorm(40), ncol = 4)
#' pairs(z, upper.panel = panel_cor,
#' lower.panel = panel_lines, diag.panel = panel_hist)
panel_cor
<-
function
(
x
,
y
)
{
par
(
usr
=
c
(
0
,
1
,
0
,
1
))
r
<-
stats
::
cor
(
x
,
y
,
use
=
"pairwise.complete.obs"
)
txt
<-
format
(
r
,
digits
=
1
)
text
(
0.5
,
0.5
,
txt
,
cex
=
0.9
/
strwidth
(
txt
)
*
abs
(
r
))
}
#' @rdname panel_cor
panel_lines
<-
function
(
x
,
y
)
{
points
(
x
,
y
,
bg
=
NA
,
cex
=
1
)
sel
<-
is.finite
(
x
)
&
is.finite
(
y
)
if
(
any
(
sel
)){
lml
<-
stats
::
lm
(
y
[
sel
]
~
x
[
sel
])
abline
(
lml
,
col
=
"blue"
)}
}
#' @rdname panel_cor
panel_hist
<-
function
(
x
)
{
usr
<-
par
(
"usr"
)
par
(
usr
=
c
(
usr
[
1
:
2
],
0
,
1.5
)
)
h
<-
hist
(
x
,
plot
=
FALSE
)
breaks
<-
h
$
breaks
nB
<-
length
(
breaks
)
y
<-
h
$
counts
/
max
(
h
$
counts
)
rect
(
breaks
[
-
nB
],
0
,
breaks
[
-1
],
y
,
col
=
"grey80"
)
}
This diff is collapsed.
Click to expand it.
man/panel_cor.Rd
0 → 100644
+
33
−
0
View file @
fee08f8e
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/panel_cor.R
\name{panel_cor}
\alias{panel_cor}
\alias{panel_lines}
\alias{panel_hist}
\title{Show correlation coefficient in pairs plot}
\usage{
panel_cor(x, y)
panel_lines(x, y)
panel_hist(x)
}
\arguments{
\item{x}{numeric vector}
\item{y}{numeric vector}
}
\description{
This and the other functions are utility functions for the pairs plot.
\code{panel_cor} shows the Pearson product-moment correlation coefficient in
the selected panels. \code{panel_lines} shows the regression line and
\code{panel_hist} histograms.
}
\examples{
z <- matrix(rnorm(40), ncol = 4)
pairs(z, upper.panel = panel_cor,
lower.panel = panel_lines, diag.panel = panel_hist)
}
\seealso{
\code{\link{pairs}}
}
This diff is collapsed.
Click to expand it.
man/trafficlight.Rd
+
1
−
1
View file @
fee08f8e
...
...
@@ -13,7 +13,7 @@ trafficlight(
probs = seq(0, 1, 0.2),
quantile_type = 7,
intervals = 5,
cols = c("re
d
", "g
old", "
yellow", "
green
yellow", "g
reen3
"),
cols = c("
g
re
en3
", "g
reen
yellow", "yellow", "g
old", "red
"),
main = "",
xlab = "",
ylab = "",
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment