Skip to content

Commit 1bbf538

Browse files
committed
documentation of get.historamscale()
1 parent fbe5336 commit 1bbf538

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

R/get.histogramscale.R

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#' @title Scaling Factor for Combined Histogramm Plots
22
#'
3-
#' @description Requires a dataframe as produced by datsteps(). (Meaning 6 columns in the following order: ID, group, minimum/earliest date, maximum/latest date, weight, 'DAT_Steps')
3+
#' @description Requires a dataframe as produced by datsteps().
4+
#' Meaning 6 columns in the following order:
5+
#' * ID,
6+
#' * group,
7+
#' * minimum/earliest date,
8+
#' * maximum/latest date,
9+
#' * weight,
10+
#' * 'DAT_Steps'
411
#'
512
#' @param DAT_df a dataframe as returned by datsteps
6-
#' @param bw the bandwidtg to use. shoudl be stepsize used to compute the dataframe, and if a df as returned by datsteps() is automatically assigned
13+
#' @param bw the bandwidth to use for the density function and histogram. Should be stepsize used to
14+
#' create the dataframe. If a df as returned by datsteps() is given, stepsize is automatically assigned
15+
#' using the corresponding attribute.
716
#'
8-
#' @return the factor with which to scale the density curve to a histogram plot
17+
#' @return the value with which to scale the density curve to a histogram plot so that both will be visible
18+
#'
19+
#' @examples
20+
#' DAT_df_steps <- datsteps(DAT_df[1:100,], stepsize = 25)
21+
#' get.histogramscale(DAT_df_steps)
922
#'
1023
#' @export get.histogramscale
1124

@@ -14,10 +27,10 @@ get.histogramscale <- function(DAT_df, bw = "auto") {
1427
if (!is.null(attributes(DAT_df)$stepsize)) {
1528
bw <- attributes(DAT_df)$stepsize
1629
} else {
17-
stop("Either specify stepsize or use a data.frame as returned by datsteps()")
30+
stop("Either specify stepsize/bandwidth (bw = ) or use a data.frame as returned by datsteps()")
1831
}
1932
} else if (!is.numeric(bw)) {
20-
stop("Either specify stepsize or use a data.frame as returned by datsteps()")
33+
stop("Either specify stepsize/bandwidth (bw = ) or use a data.frame as returned by datsteps()")
2134
}
2235
density <- density(DAT_df$DAT_step, weights = DAT_df$weight, bw = bw)
2336
breaks <- range(DAT_df$DAT_step)

man/get.histogramscale.Rd

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)