Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
svmiller committed Aug 22, 2024
1 parent 7b89708 commit c77ac5f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: stevemisc
Type: Package
Title: Steve's Miscellaneous Functions
Version: 1.7.9
Version: 1.8.0
Depends: R (>= 3.6.0), stats
Authors@R: c(
person("Steve", "Miller", email = "[email protected]",
Expand Down
21 changes: 13 additions & 8 deletions R/linloess_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
#' @author Steven V. Miller
#'
#' @param mod a fitted OLS model
#' @param resid logical, defaults to \code{FALSE}. If \code{FALSE}, the y-axis
#' @param resid logical, defaults to \code{TRUE}. If \code{FALSE}, the y-axis
#' on these plots are the raw values of the dependent variable. If \code{TRUE},
#' the y-axis is the model's residuals. Either work well here for the matter
#' at hand, provided you treat the output here as illustrative or suggestive.
#' @param se logical, defaults to \code{TRUE}. If \code{TRUE}, gives standard
#' error estimates with the assorted smoothers.
#' @param span a numeric, defaults to .75. An adjustment to the smoother. Higher
#' values permit smoother lines and might be warranted in the presence of
#' sparse pockets of the data.
#' @param smoother defaults to "loess", and is passed to the 'method' argument
#' for the non-linear smoother.
#' @param ... optional parameters, passed to the scatterplot
#' (\code{geom_point()}) component of this function. Useful if you want to make
#' the smoothers more legible against the points.
Expand All @@ -46,7 +51,7 @@
#' linloess_plot(M1, color="black", pch=21)


linloess_plot <- function(mod, resid = FALSE, se = TRUE, ...) {
linloess_plot <- function(mod, resid = TRUE, smoother = "loess", se = TRUE, span = .75, ...) {
modframe <- model.frame(mod)

if(resid == FALSE) {
Expand All @@ -62,9 +67,9 @@ linloess_plot <- function(mod, resid = FALSE, se = TRUE, ...) {
geom_point(...) +
# linear smoother
geom_smooth(method="lm", fill="blue", se = se) +
# loess smoother, with different color
geom_smooth(method="loess", color="black", linetype="dashed",
se = se)
# smoother, with different color
geom_smooth(method = smoother, color = "black", linetype = "dashed",
se = se, span = span)

} else {
modframe$.resid <- resid(mod)
Expand All @@ -81,9 +86,9 @@ linloess_plot <- function(mod, resid = FALSE, se = TRUE, ...) {
geom_point(...) +
# linear smoother
geom_smooth(method="lm", fill="blue", se = se) +
# loess smoother, with different color
geom_smooth(method="loess", color="black", linetype="dashed",
se = se)
# smoother, with different color
geom_smooth(method = smoother, color = "black", linetype = "dashed",
se = se, span = span)
}


Expand Down
4 changes: 1 addition & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ R CMD check done via `devtools::check()`, resulting in 0 errors, 0 warnings and

`devtools::spell_check()` results in a lot of typos, all of which are false positives.

This submission is accelerated by a recent email from CRAN about an error that comes up in the `ps_spells()` function. In particular, it comes with the use of `order()` on a data frame. I have since addressed that in this release.

## Downstream dependencies

`{peacesciencer}`, a package I created and maintain, is a downstream dependency. This release actually does concern that package because that package was also flagged by CRAN for the same issue that is accelerating this release. However, the issue that affects that package is directly connected to this package because `{peacesciencer}` uses the `ps_spells()` function in this package. Adequately fixing the issue here will address the issue in `{peacesciencer}`, though it does mean fixing it here first takes precedence.
`{peacesciencer}`, a package I created and maintain, is a downstream dependency. That package is unaffected by this release.
18 changes: 16 additions & 2 deletions man/linloess_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c77ac5f

Please sign in to comment.