Skip to content

Commit

Permalink
version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob A. Long authored and cran-robot committed Aug 8, 2017
1 parent d57330a commit 07cdc49
Show file tree
Hide file tree
Showing 25 changed files with 1,003 additions and 448 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: jtools
Type: Package
Title: Analysis and Presentation of Social Scientific Data
Version: 0.4.5
Version: 0.5.0
Authors@R: person(c("Jacob","A."), "Long", email = "long.1377@osu.edu",
role = c("aut", "cre"))
Description: This is a collection of tools that the author (Jacob) has written
Expand All @@ -20,8 +20,8 @@ Suggests: ggplot2, lmtest, sandwich, car, survey, weights,
RoxygenNote: 6.0.1
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2017-05-24 14:06:59 UTC; Jacob
Packaged: 2017-08-08 21:59:37 UTC; Jacob
Author: Jacob A. Long [aut, cre]
Maintainer: Jacob A. Long <long.1377@osu.edu>
Repository: CRAN
Date/Publication: 2017-05-24 23:07:03 UTC
Date/Publication: 2017-08-08 22:13:41 UTC
48 changes: 24 additions & 24 deletions MD5
@@ -1,54 +1,54 @@
c9fcece25e2b7479d55cd370dd5580a2 *DESCRIPTION
f7d42241b910e046c44a018641386251 *DESCRIPTION
1955303bf9f5e947ff6a7734cd492159 *LICENSE
7de443068b7ce01bff508f139733961f *NAMESPACE
3927739bc7c8833476c5d02c2693e6ff *NEWS.md
2072c6c3c887ef508042337b44a0637c *NAMESPACE
69546a6a39f3d51a1b5af79a7c1d9467 *NEWS.md
0d8d3fdde6bce163ad0af6badf1b1c44 *R/center_lm.R
d0f891ea099510d75059f24ab4d09747 *R/gscale.R
94a2dc341f2ac5dd3f62ff3409853064 *R/interact_plot.R
68cfed138009ac5053072af97c5c3f7e *R/gscale.R
36d1166a5da59b63aaf485a37b25ca8c *R/interact_plot.R
96f2b84aba3fa57e99cd32b93e45f4b5 *R/internal.R
2e4ae18edf89cbeca24db5ae1c7356bd *R/j_summary.R
118bfef293e696e89e50a9d416d783d3 *R/johnson_neyman.R
5869342260e4ed874efbf8a2f545fe76 *R/probe_interaction.R
6b5b1af9e2c3a8ce65ee712f358eaaf0 *R/j_summary.R
a44cfbb2c04929d93eb6ba4c5c4b5470 *R/johnson_neyman.R
46bf802684f0190efa8e2c39ba93c26e *R/probe_interaction.R
16c3050bbe7cf4d966112a90c810c1a9 *R/scale_lm.R
3e6dad6a1cfcaf5971467d003f2e0d0b *R/simple_slopes.R
e21d22d329ca6bff2ec2814cf372fab5 *R/simple_slopes.R
90d0db9785b602c674b713286b471173 *R/svycor.R
674eb20d69acd5a1d32457feae68b8c2 *R/svysd.R
4478f432eebcc34bef702c7846042841 *R/theme_apa.R
02c45b7d02ce712b416dd48a2698fb91 *R/wgttest.R
01692350d280ac8e64cfc396c115d6b0 *README.md
baa3ee1ff2d8a8c4f753b994356d3dea *R/wgttest.R
afdfe062d7e007ef80e16a0680b05bba *README.md
89f347f47be53aac47e3a1d787cf0bcc *build/vignette.rds
63eb1bc6ef2d7d6c7bec8c7a55a35790 *inst/CITATION
82b99fb1a2bee46fe3e4724cdd72e8f5 *inst/CITATION
fcbdd288901706e698b39895a3ecd24e *inst/doc/interactions.R
2f41db9b1761697eb61bfee4fd9679ab *inst/doc/interactions.Rmd
f88e8ba89731ca477d0f62e5d0d4979f *inst/doc/interactions.html
7f2a8c57448319cb1d7b84b779bd6fde *inst/doc/interactions.html
5ac7c50306d285c394b6cb9bad675dbf *inst/doc/j_summ.R
ae5b9b8537f8cfce37eb8a2331f2a332 *inst/doc/j_summ.Rmd
6e9a97f2b3f1adb1eb31e9b98c2c00a0 *inst/doc/j_summ.html
57cce60a2096303c9ce9ba61675422fe *inst/doc/j_summ.html
8bdc85384181cceaddb1f0d5703e2037 *inst/doc/svycor.R
2bf323910af42bded5d29b3a0961bb4e *inst/doc/svycor.Rmd
76b158285ff5315d50517892d7652f72 *inst/doc/svycor.html
0d638c4858fdffa8a4703b688db83092 *inst/doc/svycor.html
08b9872b5883d00d731cfe646557d67e *man/center_lm.Rd
5ac5cf87cef6823f260aff1e478b61ee *man/gscale.Rd
e65e20b205ecd7c0f164bcdc1b366505 *man/interact_plot.Rd
c523e3ef1d3227442e687b51ac07b5ec *man/j_summ.Rd
6e9e02d44125e13fe6acff175df7349c *man/interact_plot.Rd
b6652ac9ac271efe725fcffd7f1abc1f *man/j_summ.Rd
2f3a3f72b72039c6d45fa725f19c33ec *man/johnson_neyman.Rd
0beb508256c1dd988c97e1bb1de26fcf *man/probe_interaction.Rd
9d60ea693e899f7d6bd4b9bd77998ed3 *man/scale_lm.Rd
1d247beb07308d904e88c0df35014899 *man/sim_slopes.Rd
d9224e4b96cc45a06581ebc651411c09 *man/svycor.Rd
f3aed175c95b46239be0a0ecf9f52b9c *man/svysd.Rd
7f094bf0752b1a18dbfbd80bd6b0c7e6 *man/theme_apa.Rd
688f78b760b2cd9c0f191330ed67ffc5 *man/wgttest.Rd
c5b5b63f050f71339c633c555b396fd1 *man/wgttest.Rd
f4c841e89ad33e3419091a8a673b5262 *tests/testthat.R
92d6b291b8b229a01e518e2dc4f9eac0 *tests/testthat/test-gscale.R
318dca7c813ba6de19af1cf3c873b28e *tests/testthat/test-jsumm.R
0473bf2cdc972e5688e468949900b2ac *tests/testthat/test-misc.R
1b51b852a9deea4f7338db49d01c6cf8 *tools/README-interact_plot_continuous-1.png
353770aa04351af1b7e2cc933ca14445 *tools/README-interact_plot_factor-1.png
76c8f1c0dbd321a385f329bb1b76c1b8 *tools/README-j-n-plot-1.png
15a147836f40aab8cf7432832a2f98c2 *tools/README-probe_interaction_ex-1.png
511ddd70a874d9dad6a69fd90fe6565f *tools/README-theme_apa_ex-1.png
b63a015aaa96f290191f93943e82b6d6 *tools/README-theme_apa_facet_ex-1.png
d71fb1ba48a93074b47a4404af631028 *tools/README-interact_plot_continuous-1.png
c86140e1275d84d9263e15646d51fada *tools/README-interact_plot_factor-1.png
12a3ea0a69f70362278cf807f8228e4f *tools/README-j-n-plot-1.png
41605fb6f617fa0fa1bbc9a5d7badca6 *tools/README-probe_interaction_ex-1.png
3a0bf9c65d0a2f0992472b4521368a77 *tools/README-theme_apa_ex-1.png
fe48fb20e05fadff4f95453459531258 *tools/README-theme_apa_facet_ex-1.png
2f41db9b1761697eb61bfee4fd9679ab *vignettes/interactions.Rmd
ae5b9b8537f8cfce37eb8a2331f2a332 *vignettes/j_summ.Rmd
2bf323910af42bded5d29b3a0961bb4e *vignettes/svycor.Rmd
3 changes: 3 additions & 0 deletions NAMESPACE
Expand Up @@ -14,6 +14,7 @@ S3method(print,probe_interaction)
S3method(print,sim_slopes)
S3method(print,svycor)
S3method(print,svysd)
S3method(print,wgttest)
export(center_lm)
export(gscale)
export(interact_plot)
Expand All @@ -39,7 +40,9 @@ importFrom(stats,formula)
importFrom(stats,getCall)
importFrom(stats,lm)
importFrom(stats,logLik)
importFrom(stats,median)
importFrom(stats,model.frame)
importFrom(stats,model.offset)
importFrom(stats,na.pass)
importFrom(stats,pf)
importFrom(stats,predict)
Expand Down
35 changes: 35 additions & 0 deletions NEWS.md
@@ -1,3 +1,38 @@
## jtools 0.5.0

More goodies for users of interact_plot:

* Added support for models with a weights parameter in interact_plot. It would
work previously, but didn't use a weighted mean or SD in calculating values of
the moderator(s) and for mean-centering other predictors. Now it does.
* Added support for two-level factor predictors in interact_plot. Previously,
factor variables had to be a moderator.
* When predictor in interact_plot has only two unique values (e.g., dummy
variables that have numeric class), by default only those two values have
tick marks on the x-axis. Users may use the pred.labels argument to specify
labels for those ticks.
* Offsets are now supported (especially useful for Poisson GLMs), but only
if specified via the offset argument rather than included in the model formula.
You can (and should) specify the offset used for the plot using the set.offset
argument. By default it is 1 so that the y-axis represents a proportion.

Other feature changes:

* sim_slopes now supports weights (from the weights argument rather than a
svyglm model). Previously it used unweighted mean and standard deviation for
non-survey models with weights.
* Improved printing features of wgttest

Bug fixes:

* R 3.4 introduced a change that caused warning messages when return objects
are created in a certain way. This was first addressed in jtools 0.4.5, but
a few instances slipped through the cracks. Thanks to Kim Henry for pointing
out one such instance.
* When sim_slopes called johnson_neyman while the robust argument was set to
TRUE, the robust.type argument was not being passed (causing the default of
"HC3" to be used). Now it is passing that argument correctly.

## jtools 0.4.5

* Added better support for plotting nonlinear interactions with interact_plot,
Expand Down
35 changes: 28 additions & 7 deletions R/gscale.R
Expand Up @@ -252,9 +252,14 @@ if (is.numeric(x)) {
# Loop through the variable names
for (i in x) {

# Dealing with two-level factors
if (length(unique(d[,i])) == 2 && is.factor(d[,i])) {
d[,i] <- as.numeric(d[,i]) - 1
} # Now it will follow the logic of any numeric binary var

# Now just calling the rescale function, basically
# for binary cases
if (length(unique(d[,i]))==2 && is.numeric(d[,i])) {
if (length(unique(d[,i])) == 2 && is.numeric(d[,i])) {

if (binary.inputs=="0/1") {

Expand Down Expand Up @@ -357,17 +362,22 @@ if (is.numeric(x)) {
}
}

if (!is.numeric(d[,i]) || all(is.na(d[,i])) || skip == TRUE) {
# just skip over non-numeric variables
if ((!is.numeric(d[,i]) & length(unique(d[,i])) != 2) || all(is.na(d[,i])) || skip == TRUE) {
# just skip over non-numeric variables except binary factors
# columns that are all NA will still show up as numeric
if (all(is.na(d[,i]))) {
message <- paste("All values of", names(d)[i], "were NA. Skipping...\n")
warning(message)
}
} else {

# Dealing with two-level factors
if (length(unique(d[,i])) == 2 && is.factor(d[,i])) {
d[,i] <- as.numeric(d[,i]) - 1
} # Now it will follow the logic of any numeric binary var

# for binary cases
if (length(unique(d[,i]))==2) {
if (length(unique(d[,i])) == 2) {

if (binary.inputs=="0/1") {

Expand Down Expand Up @@ -449,7 +459,7 @@ if (is.numeric(x)) {
# Just calling rescale
for (i in x) {

if (!is.numeric(d[,i]) || all(is.na(d[,i]))) {
if ((!is.numeric(d[,i]) & length(unique(d[,i])) != 2) || all(is.na(d[,i]))) {
# just skip over non-numeric variables
# columns that are all NA will still show up as numeric
if (all(is.na(d[,i]))) {
Expand All @@ -458,6 +468,11 @@ if (is.numeric(x)) {
}
} else {

# Dealing with two-level factors
if (length(unique(d[,i])) == 2 && is.factor(d[,i])) {
d[,i] <- as.numeric(d[,i]) - 1
} # Now it will follow the logic of any numeric binary var

# for binary cases
if (length(unique(d[,i])) == 2) {

Expand Down Expand Up @@ -547,7 +562,7 @@ if (is.numeric(x)) {
# I need its actual name for the svymean() commands
i <- names(d)[i]

if (!is.numeric(d[,i]) || all(is.na(d[,i]))) {
if ((!is.numeric(d[,i]) & length(unique(d[,i])) != 2) || all(is.na(d[,i]))) {
# just skip over non-numeric variables
# columns that are all NA will still show up as numeric
if (all(is.na(d[,i]))) {
Expand All @@ -556,8 +571,14 @@ if (is.numeric(x)) {
}
} else {

# Dealing with two-level factors
if (length(unique(d[,i])) == 2 && is.factor(d[,i])) {
d[,i] <- as.numeric(d[,i]) - 1
design$variables <- d
} # Now it will follow the logic of any numeric binary var

# for binary cases
if (length(unique(d[,i]))==2) {
if (length(unique(d[,i])) == 2) {

if (binary.inputs=="0/1") {

Expand Down

0 comments on commit 07cdc49

Please sign in to comment.