Skip to content
Snippets Groups Projects
Commit 6fd48f38 authored by Otto, Dr. Saskia's avatar Otto, Dr. Saskia
Browse files

some minor changes in the order of arguments

parent f1aa60b3
No related branches found
No related tags found
No related merge requests found
...@@ -8,14 +8,8 @@ ...@@ -8,14 +8,8 @@
#' @param time vector of time units that will be used for the x axis. #' @param time vector of time units that will be used for the x axis.
#' @param sort_5yrmean logical; should the variables be sorted by the first 5yr mean? Default #' @param sort_5yrmean logical; should the variables be sorted by the first 5yr mean? Default
#' is set to TRUE. #' is set to TRUE.
#' @param sort_vec If specific order of variable is desired the sorting index should be #' @param sort_vec integer vector; if specific order of variable is desired the sorting index should be
#' provided here. #' provided here.
#' @param main A title.
#' @param xlab The x axis title. Default is none.
#' @param ylab The y axis title. Default is none.
#' @param adj_xlab integer; vertical adjustment of the x axis title.
#' @param adj_ylab integer; horizontal adjustment of the y axis title.
#' @param cols A character vector with colors for each quantile or interval.
#' @param method character; the type of methods to create the color code. Choose #' @param method character; the type of methods to create the color code. Choose
#' between using "quantiles" (default) or "intervals". #' between using "quantiles" (default) or "intervals".
#' @param probs a vector of probabilities to calculate the quantiles using the function #' @param probs a vector of probabilities to calculate the quantiles using the function
...@@ -25,10 +19,16 @@ ...@@ -25,10 +19,16 @@
#' @param quantile_type an integer between 1 and 9 selecting one of the nine quantile #' @param quantile_type an integer between 1 and 9 selecting one of the nine quantile
#' algorithms detailed below to be used. Default is 7 (see also \code{\link{quantile}}). #' algorithms detailed below to be used. Default is 7 (see also \code{\link{quantile}}).
#' @param intervals logical; number of evenly-spaced intervals. Default is 5. #' @param intervals logical; number of evenly-spaced intervals. Default is 5.
#' @param cols a character vector with colors for each quantile or interval.
#' @param main a title.
#' @param xlab The x axis title. Default is none.
#' @param ylab The y axis title. Default is none.
#' @param adj_xlab integer; vertical adjustment of the x axis title.
#' @param adj_ylab integer; horizontal adjustment of the y axis title.
#' @param hadj_x double; horizontal adjustment of the x labels. #' @param hadj_x double; horizontal adjustment of the x labels.
#' @param vadj_x double; vertical adjustment of the x labels. #' @param vadj_x double; vertical adjustment of the x labels.
#' @param hadj_y double; horizontal adjustment of the x labels. #' @param hadj_y double; horizontal adjustment of the y labels.
#' @param vadj_y double; vertical adjustment of the x labels. #' @param vadj_y double; vertical adjustment of the y labels.
#' @param madj_bottom double; adjustment of bottom margin relative to the #' @param madj_bottom double; adjustment of bottom margin relative to the
#' current setting. #' current setting.
#' @param madj_left double; adjustment of left margin relative to the #' @param madj_left double; adjustment of left margin relative to the
...@@ -58,20 +58,19 @@ ...@@ -58,20 +58,19 @@
#' @param respect logical; this argument controls whether a unit column-width is the #' @param respect logical; this argument controls whether a unit column-width is the
#' same physical measurement on the device as a unit row-height (default is TRUE). #' same physical measurement on the device as a unit row-height (default is TRUE).
#' #'
#'
#' @export #' @export
#' @author Saskia A. Otto
#' @examples #' @examples
#' df <- data.frame(aaaaaaaa = 1:20, bbbbbbbbbb= rnorm(20, 100, 30), c = 1:20 + rnorm(20)) #' df <- data.frame(variable1 = 1:20, variable2= rnorm(20, 100, 30), variable3 = 1:20 + rnorm(20))
#' trafficlight(x = df, time = 1981:2000) #' trafficlight(x = df, time = 1981:2000)
#' df <- matrix(rnorm(100), ncol = 5) #' df <- matrix(rnorm(100), ncol = 5)
#' colnames(df) <- letters[1:5] #' colnames(df) <- letters[1:5]
#' trafficlight(x = df, time = 1981:2000, legend_pos = "bottom", method = "intervals") #' trafficlight(x = df, time = 1981:2000, legend_pos = "bottom", method = "intervals")
trafficlight <- function(x, time = NULL, sort_5yrmean = TRUE, sort_vec = NULL, trafficlight <- function(x, time = NULL, sort_5yrmean = TRUE, sort_vec = NULL,
main = "", xlab = "", ylab = "", adj_xlab = NULL, adj_ylab = NULL, method = "quantiles", probs = seq(0, 1, 0.2), quantile_type = 7, intervals = 5,
cols = c("green", "yellowgreen", "yellow", "gold", "red"), cols = c("green", "yellowgreen", "yellow", "gold", "red"),
method = "quantiles", main = "", xlab = "", ylab = "", adj_xlab = NULL, adj_ylab = NULL,
probs = seq(0, 1, 0.2), quantile_type = 7, intervals = 5,
hadj_x = 0.5, vadj_x = -0.7, hadj_y = -0.7, vadj_y = 0.3, hadj_x = 0.5, vadj_x = -0.7, hadj_y = -0.7, vadj_y = 0.3,
madj_bottom = 0, madj_left = 0, madj_top = 0, madj_right = 0, madj_bottom = 0, madj_left = 0, madj_top = 0, madj_right = 0,
legend_pos = "top", legend_intersp_x = 1, legend_intersp_y = 1, legend_pos = "top", legend_intersp_x = 1, legend_intersp_y = 1,
......
...@@ -9,16 +9,16 @@ trafficlight( ...@@ -9,16 +9,16 @@ trafficlight(
time = NULL, time = NULL,
sort_5yrmean = TRUE, sort_5yrmean = TRUE,
sort_vec = NULL, sort_vec = NULL,
method = "quantiles",
probs = seq(0, 1, 0.2),
quantile_type = 7,
intervals = 5,
cols = c("green", "yellowgreen", "yellow", "gold", "red"),
main = "", main = "",
xlab = "", xlab = "",
ylab = "", ylab = "",
adj_xlab = NULL, adj_xlab = NULL,
adj_ylab = NULL, adj_ylab = NULL,
cols = c("green", "yellowgreen", "yellow", "gold", "red"),
method = "quantiles",
probs = seq(0, 1, 0.2),
quantile_type = 7,
intervals = 5,
hadj_x = 0.5, hadj_x = 0.5,
vadj_x = -0.7, vadj_x = -0.7,
hadj_y = -0.7, hadj_y = -0.7,
...@@ -49,21 +49,9 @@ trafficlight( ...@@ -49,21 +49,9 @@ trafficlight(
\item{sort_5yrmean}{logical; should the variables be sorted by the first 5yr mean? Default \item{sort_5yrmean}{logical; should the variables be sorted by the first 5yr mean? Default
is set to TRUE.} is set to TRUE.}
\item{sort_vec}{If specific order of variable is desired the sorting index should be \item{sort_vec}{integer vector; if specific order of variable is desired the sorting index should be
provided here.} provided here.}
\item{main}{A title.}
\item{xlab}{The x axis title. Default is none.}
\item{ylab}{The y axis title. Default is none.}
\item{adj_xlab}{integer; vertical adjustment of the x axis title.}
\item{adj_ylab}{integer; horizontal adjustment of the y axis title.}
\item{cols}{A character vector with colors for each quantile or interval.}
\item{method}{character; the type of methods to create the color code. Choose \item{method}{character; the type of methods to create the color code. Choose
between using "quantiles" (default) or "intervals".} between using "quantiles" (default) or "intervals".}
...@@ -77,13 +65,25 @@ algorithms detailed below to be used. Default is 7 (see also \code{\link{quantil ...@@ -77,13 +65,25 @@ algorithms detailed below to be used. Default is 7 (see also \code{\link{quantil
\item{intervals}{logical; number of evenly-spaced intervals. Default is 5.} \item{intervals}{logical; number of evenly-spaced intervals. Default is 5.}
\item{cols}{a character vector with colors for each quantile or interval.}
\item{main}{a title.}
\item{xlab}{The x axis title. Default is none.}
\item{ylab}{The y axis title. Default is none.}
\item{adj_xlab}{integer; vertical adjustment of the x axis title.}
\item{adj_ylab}{integer; horizontal adjustment of the y axis title.}
\item{hadj_x}{double; horizontal adjustment of the x labels.} \item{hadj_x}{double; horizontal adjustment of the x labels.}
\item{vadj_x}{double; vertical adjustment of the x labels.} \item{vadj_x}{double; vertical adjustment of the x labels.}
\item{hadj_y}{double; horizontal adjustment of the x labels.} \item{hadj_y}{double; horizontal adjustment of the y labels.}
\item{vadj_y}{double; vertical adjustment of the x labels.} \item{vadj_y}{double; vertical adjustment of the y labels.}
\item{madj_bottom}{double; adjustment of bottom margin relative to the \item{madj_bottom}{double; adjustment of bottom margin relative to the
current setting.} current setting.}
...@@ -134,9 +134,12 @@ This function creates for multiple time series an image plot where the color ...@@ -134,9 +134,12 @@ This function creates for multiple time series an image plot where the color
code is based on selected quantiles or evenly spaced intervals. code is based on selected quantiles or evenly spaced intervals.
} }
\examples{ \examples{
df <- data.frame(aaaaaaaa = 1:20, bbbbbbbbbb= rnorm(20, 100, 30), c = 1:20 + rnorm(20)) df <- data.frame(variable1 = 1:20, variable2= rnorm(20, 100, 30), variable3 = 1:20 + rnorm(20))
trafficlight(x = df, time = 1981:2000) trafficlight(x = df, time = 1981:2000)
df <- matrix(rnorm(100), ncol = 5) df <- matrix(rnorm(100), ncol = 5)
colnames(df) <- letters[1:5] colnames(df) <- letters[1:5]
trafficlight(x = df, time = 1981:2000, legend_pos = "bottom", method = "intervals") trafficlight(x = df, time = 1981:2000, legend_pos = "bottom", method = "intervals")
} }
\author{
Saskia A. Otto
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment