Commit 924cb73c authored by Gjalt-Jorn Peters's avatar Gjalt-Jorn Peters

fixed minor 'descr' bug

parent 2b270d18
Pipeline #239134910 passed with stage
in 6 minutes and 5 seconds
Package: ufs
Type: Package
Title: Quantitative Analysis Made Accessible
Version: 0.4.0
Version: 0.4.1
Authors@R:
c(
person(given = "Gjalt-Jorn",
......
......@@ -12,7 +12,7 @@
#' @references Bobko, P., Roth, P. L., & Bobko, C. (2001). Correcting
#' the Effect Size of d for Range Restriction and Unreliability.
#' *Organizational Research Methods, 4*(1), 46–61.
#' \url{https://doi.org/10.1177/109442810141003}
#' \doi{10.1177/109442810141003}
#'
#' @examples
#' attenuate.d(.5, .8);
......
......@@ -25,7 +25,7 @@
#' @seealso [behaviorchange::nnc()]
#' @references Gruijters, S. L., & Peters, G. Y. (2019). Gauging the
#' impact of behavior change interventions: A tutorial on the Numbers
#' Needed to Treat. *PsyArXiv.* doi:[10.31234/osf.io/2bau7](https://doi.org/10.31234/osf.io/2bau7)
#' Needed to Treat. *PsyArXiv.* \doi{10.31234/osf.io/2bau7}
#' @keywords utilities
#' @rdname nncConversion
#' @examples
......
......@@ -43,7 +43,7 @@
#' @author Gjalt-Jorn Peters
#'
#' Maintainer: Gjalt-Jorn Peters <gjalt-jorn@@userfriendlyscience.com>
#' @seealso \code{\link{summary}}, [psych::describe()
#' @seealso \code{\link{summary}}, [psych::describe()]
#' @references Hartigan, J. A.; Hartigan, P. M. The Dip Test of Unimodality.
#' Ann. Statist. 13 (1985), no. 1, 70--84. doi:10.1214/aos/1176346577.
#' https://projecteuclid.org/euclid.aos/1176346577.
......@@ -181,8 +181,36 @@ pander.descr <- function(x, headerPrefix = "",
#' @method as.data.frame descr
#' @rdname descriptives
#' @export
as.data.frame.descr <- function(x, row.names=NULL, optional=FALSE, ...) {
res <- as.data.frame(t(matrix(unlist(x)[c(1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18)])),
as.data.frame.descr <- function(x, row.names=NULL,
optional=FALSE, ...) {
if (!is.null(attr(x, 'digits'))) {
res <-
unlist(lapply(
x,
function(valList) {
return(
unlist(
lapply(
valList,
function(val) {
if (is.numeric(val)) {
return(round(val, attr(x, 'digits')));
} else {
return(val);
}
}
)
)
);
}
));
} else {
res <-
unlist(x);
}
res <- res[c(1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
res <- as.data.frame(t(matrix(res)),
row.names=row.names,
optional=optional,
...);
......
......@@ -13,7 +13,7 @@
#' @references Bobko, P., Roth, P. L., & Bobko, C. (2001). Correcting
#' the Effect Size of d for Range Restriction and Unreliability.
#' *Organizational Research Methods, 4*(1), 46–61.
#' \url{https://doi.org/10.1177/109442810141003}
#' \doi{10.1177/109442810141003}
#'
#' @examples
#' disattenuate.d(.5, .8);
......
......@@ -22,7 +22,7 @@
#'
#' Maintainer: Gjalt-Jorn Peters <gjalt-jorn@@userfriendlyscience.com>
#' @seealso \code{\link[base]{grep}}, \code{Hmisc},
#' \url{http://biostat.mc.vanderbilt.edu/wiki/Main/Hmisc},
#' \url{https://hbiostat.org/R/Hmisc/},
#' \url{https://github.com/harrelfe/Hmisc}
#' @keywords manip character programming
#' @examples
......
......@@ -24,8 +24,13 @@
#' arguments to [colorRamp()] (and therefore, to
#' [col2rgb()]).
#' @param labels The labels to use for the items (on the Y axis).
#' @param showLoadings Whether to show the factor loadings or not.
#' @param heatmap Whether to produce a heatmap or use diamond plots.
#' @param theme The ggplot2 theme to use.
#' @param sortAlphabetically Whether to sort the items alphabetically.
#' @param digits Number of digits to round to.
#' @param labs The labels to pass to ggplot2.
#' @param themeArgs Additional theme arguments to pass to ggplot2.
#' @param \dots Additional arguments will be passed to
#' [ggDiamondLayer()]. This can be used to set, for example, the
#' transparency (alpha value) of the diamonds to a lower value using e.g.
......
......@@ -43,7 +43,7 @@ regrInfluential <- function(formula, data, createPlot = TRUE) {
res <- list(input = as.list(environment()), intermediate = list(),
output = list())
### Get variables in formula
res$intermediate$variableNames <- all.vars(formula)
res$intermediate$variableNames <- all.vars(formula);
### Store temporary dataframe
res$intermediate$dat <-
data.frame(stats::na.omit(data[, res$intermediate$variableNames]));
......@@ -56,20 +56,23 @@ regrInfluential <- function(formula, data, createPlot = TRUE) {
indexOfInfluentiality = rowSums(res$intermediate$influence.measures$is.inf));
### Generate scattermatrix showing index fo influentiality
res$output$plot <-
GGally::ggpairs(data=res$intermediate$dat[,
c(res$intermediate$variableNames,
'indexOfInfluentiality')],
columns=1:length(res$intermediate$variableNames),
upper='blank',
lower=list(continuous=function(data, mapping, ...) {
res <- ggplot2::ggplot(data=data, mapping=mapping) +
ggplot2::geom_point(position="jitter") +
ggplot2::scale_colour_gradient(low='green', high='red') +
ggplot2::theme_bw();
return(res);
}),
mapping=ggplot2::aes_string(colour='indexOfInfluentiality'));
if (createPlot) {
res$output$plot <-
GGally::ggpairs(data=res$intermediate$dat[,
c(res$intermediate$variableNames,
'indexOfInfluentiality')],
columns=1:length(res$intermediate$variableNames),
upper='blank',
lower=list(continuous=function(data, mapping, ...) {
res <- ggplot2::ggplot(data=data, mapping=mapping) +
ggplot2::geom_point(position="jitter") +
ggplot2::scale_colour_gradient(low='green', high='red') +
ggplot2::theme_bw();
return(res);
}),
mapping=ggplot2::aes_string(colour='indexOfInfluentiality'));
}
### Conduct regression analyses for all levels of indexOfInfluentiality
### higher than 0
res$output$regrObjects <- list();
......@@ -96,7 +99,9 @@ print.regrInfluential <- function(x,
repStr("#", headingLevel),
" Influential cases:\n\n");
print(x$output$dat.diagnostics);
print(x$output$plot);
if (!is.null(x$output$plot)) {
print(x$output$plot);
}
ufs::cat0("\n",
repStr("#", headingLevel + 1),
" Regression analyses, repeated without influential cases\n\n");
......
......@@ -95,41 +95,41 @@
#' @references Crutzen, R., & Peters, G.-J. Y. (2015). Scale quality: alpha is
#' an inadequate estimate and factor-analytic evidence is needed first of all.
#' \emph{Health Psychology Review.}
#' \url{https://doi.org/10.1080/17437199.2015.1124240}
#' \doi{10.1080/17437199.2015.1124240}
#'
#' Dunn, T. J., Baguley, T., & Brunsden, V. (2014). From alpha to omega: A
#' practical solution to the pervasive problem of internal consistency
#' estimation. \emph{British Journal of Psychology}, 105(3), 399-412.
#' \url{https://doi.org/10.1111/bjop.12046}
#' \doi{10.1111/bjop.12046}
#'
#' Eisinga, R., Grotenhuis, M. Te, & Pelzer, B. (2013). The reliability of a
#' two-item scale: Pearson, Cronbach, or Spearman-Brown? \emph{International
#' Journal of Public Health}, 58(4), 637-42.
#' \url{https://doi.org/10.1007/s00038-012-0416-3}
#' \doi{10.1007/s00038-012-0416-3}
#'
#' Gadermann, A. M., Guhn, M., Zumbo, B. D., & Columbia, B. (2012). Estimating
#' ordinal reliability for Likert-type and ordinal item response data: A
#' conceptual, empirical, and practical guide. \emph{Practical Assessment,
#' Research & Evaluation}, 17(3), 1-12. \url{https://doi.org/10.7275/n560-j767}
#' Research & Evaluation}, 17(3), 1-12. \doi{10.7275/n560-j767}
#'
#' Peters, G.-J. Y. (2014). The alpha and the omega of scale reliability and
#' validity: why and how to abandon Cronbach's alpha and the route towards more
#' comprehensive assessment of scale quality. \emph{European Health
#' Psychologist}, 16(2), 56-69.
#' \url{https://doi.org/10.31234/osf.io/h47fv}
#' \doi{10.31234/osf.io/h47fv}
#'
#' Revelle, W., & Zinbarg, R. E. (2009). Coefficients Alpha, Beta, Omega, and
#' the glb: Comments on Sijtsma. \emph{Psychometrika}, 74(1), 145-154.
#' \url{https://doi.org/10.1007/s11336-008-9102-z}
#' \doi{10.1007/s11336-008-9102-z}
#'
#' Sijtsma, K. (2009). On the Use, the Misuse, and the Very Limited Usefulness
#' of Cronbach's Alpha. \emph{Psychometrika}, 74(1), 107-120.
#' \url{https://doi.org/10.1007/s11336-008-9101-0}
#' \doi{10.1007/s11336-008-9101-0}
#'
#' Zinbarg, R. E., Revelle, W., Yovel, I., & Li, W. (2005). Cronbach's alpha,
#' Revelle's beta and McDonald's omega H: Their relations with each other and
#' two alternative conceptualizations of reliability. \emph{Psychometrika},
#' 70(1), 123-133. \url{https://doi.org/10.1007/s11336-003-0974-7}
#' 70(1), 123-133. \doi{10.1007/s11336-003-0974-7}
#'
#' @keywords utilities univar
#' @rdname scaleStructure
......
......@@ -61,7 +61,7 @@ install.packages('", packagename, "');
```"));
```
You can install the development version of ``r packagename`` from [GitLab](https://gitlab.com) with:
You can install the development version of ``r packagename`` from [GitLab](https://about.gitlab.com) with:
```{r echo=FALSE, comment="", results="asis"}
cat(paste0("``` r
......
......@@ -30,7 +30,7 @@ install.packages('ufs');
```
You can install the development version of `ufs` from
[GitLab](https://gitlab.com) with:
[GitLab](https://about.gitlab.com) with:
``` r
remotes::install_gitlab('r-packages/ufs');
......
......@@ -25,7 +25,7 @@ attenuate.d(.5, .8);
Bobko, P., Roth, P. L., & Bobko, C. (2001). Correcting
the Effect Size of d for Range Restriction and Unreliability.
\emph{Organizational Research Methods, 4}(1), 46–61.
\url{https://doi.org/10.1177/109442810141003}
\doi{10.1177/109442810141003}
}
\author{
Gjalt-Jorn Peters & Stefan Gruijters
......
......@@ -26,7 +26,7 @@ disattenuate.d(.5, .8);
Bobko, P., Roth, P. L., & Bobko, C. (2001). Correcting
the Effect Size of d for Range Restriction and Unreliability.
\emph{Organizational Research Methods, 4}(1), 46–61.
\url{https://doi.org/10.1177/109442810141003}
\doi{10.1177/109442810141003}
}
\author{
Gjalt-Jorn Peters & Stefan Gruijters
......
......@@ -41,7 +41,7 @@ if(!any(grep(escapeRegex(string), string))) {
}
\seealso{
\code{\link[base]{grep}}, \code{Hmisc},
\url{http://biostat.mc.vanderbilt.edu/wiki/Main/Hmisc},
\url{https://hbiostat.org/R/Hmisc/},
\url{https://github.com/harrelfe/Hmisc}
}
\author{
......
......@@ -37,10 +37,20 @@ arguments to \code{\link[=colorRamp]{colorRamp()}} (and therefore, to
\item{labels}{The labels to use for the items (on the Y axis).}
\item{showLoadings}{Whether to show the factor loadings or not.}
\item{heatmap}{Whether to produce a heatmap or use diamond plots.}
\item{theme}{The ggplot2 theme to use.}
\item{sortAlphabetically}{Whether to sort the items alphabetically.}
\item{digits}{Number of digits to round to.}
\item{labs}{The labels to pass to ggplot2.}
\item{themeArgs}{Additional theme arguments to pass to ggplot2.}
\item{\dots}{Additional arguments will be passed to
\code{\link[=ggDiamondLayer]{ggDiamondLayer()}}. This can be used to set, for example, the
transparency (alpha value) of the diamonds to a lower value using e.g.
......
......@@ -77,7 +77,7 @@ convert.d.to.nnc(d=.5, cer=.25);
\references{
Gruijters, S. L., & Peters, G. Y. (2019). Gauging the
impact of behavior change interventions: A tutorial on the Numbers
Needed to Treat. \emph{PsyArXiv.} doi:\href{https://doi.org/10.31234/osf.io/2bau7}{10.31234/osf.io/2bau7}
Needed to Treat. \emph{PsyArXiv.} \doi{10.31234/osf.io/2bau7}
}
\seealso{
\code{\link[behaviorchange:nnc]{behaviorchange::nnc()}}
......
......@@ -196,41 +196,41 @@ scaleStructure(ordinalExampleData, ci=FALSE);
Crutzen, R., & Peters, G.-J. Y. (2015). Scale quality: alpha is
an inadequate estimate and factor-analytic evidence is needed first of all.
\emph{Health Psychology Review.}
\url{https://doi.org/10.1080/17437199.2015.1124240}
\doi{10.1080/17437199.2015.1124240}
Dunn, T. J., Baguley, T., & Brunsden, V. (2014). From alpha to omega: A
practical solution to the pervasive problem of internal consistency
estimation. \emph{British Journal of Psychology}, 105(3), 399-412.
\url{https://doi.org/10.1111/bjop.12046}
\doi{10.1111/bjop.12046}
Eisinga, R., Grotenhuis, M. Te, & Pelzer, B. (2013). The reliability of a
two-item scale: Pearson, Cronbach, or Spearman-Brown? \emph{International
Journal of Public Health}, 58(4), 637-42.
\url{https://doi.org/10.1007/s00038-012-0416-3}
\doi{10.1007/s00038-012-0416-3}
Gadermann, A. M., Guhn, M., Zumbo, B. D., & Columbia, B. (2012). Estimating
ordinal reliability for Likert-type and ordinal item response data: A
conceptual, empirical, and practical guide. \emph{Practical Assessment,
Research & Evaluation}, 17(3), 1-12. \url{https://doi.org/10.7275/n560-j767}
Research & Evaluation}, 17(3), 1-12. \doi{10.7275/n560-j767}
Peters, G.-J. Y. (2014). The alpha and the omega of scale reliability and
validity: why and how to abandon Cronbach's alpha and the route towards more
comprehensive assessment of scale quality. \emph{European Health
Psychologist}, 16(2), 56-69.
\url{https://doi.org/10.31234/osf.io/h47fv}
\doi{10.31234/osf.io/h47fv}
Revelle, W., & Zinbarg, R. E. (2009). Coefficients Alpha, Beta, Omega, and
the glb: Comments on Sijtsma. \emph{Psychometrika}, 74(1), 145-154.
\url{https://doi.org/10.1007/s11336-008-9102-z}
\doi{10.1007/s11336-008-9102-z}
Sijtsma, K. (2009). On the Use, the Misuse, and the Very Limited Usefulness
of Cronbach's Alpha. \emph{Psychometrika}, 74(1), 107-120.
\url{https://doi.org/10.1007/s11336-008-9101-0}
\doi{10.1007/s11336-008-9101-0}
Zinbarg, R. E., Revelle, W., Yovel, I., & Li, W. (2005). Cronbach's alpha,
Revelle's beta and McDonald's omega H: Their relations with each other and
two alternative conceptualizations of reliability. \emph{Psychometrika},
70(1), 123-133. \url{https://doi.org/10.1007/s11336-003-0974-7}
70(1), 123-133. \doi{10.1007/s11336-003-0974-7}
}
\seealso{
\code{\link[psych:omega]{psych::omega()}}, \code{\link[psych:alpha]{psych::alpha()}}, and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment