From b317b9eed382023baa439123e8bdb00af9f3c7f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Mar 2024 07:49:53 -0400 Subject: [PATCH] 423 --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/floodlight_2_by_continuous.R | 7 +++++-- R/scatterplot.R | 7 +++++-- inst/CITATION | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ea4073b..23eb18b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: kim Title: A Toolkit for Behavioral Scientists -Version: 0.5.422 +Version: 0.5.423 Authors@R: person(given = "Jin", family = "Kim", diff --git a/NEWS.md b/NEWS.md index 083ead7..b50b908 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# kim 0.5.423 +* Updated the following function(s) (and other functions that use them): +floodlight_2_by_continuous, scatterplot + # kim 0.5.422 * Updated the following function(s) (and other functions that use them): scatterplot, loglinear_analysis, plot_group_means, two_way_anova, diff --git a/R/floodlight_2_by_continuous.R b/R/floodlight_2_by_continuous.R index 2c451b4..bf5e415 100644 --- a/R/floodlight_2_by_continuous.R +++ b/R/floodlight_2_by_continuous.R @@ -372,7 +372,8 @@ floodlight_2_by_continuous <- function( } # add jitter if any pair of dots overlap dt[, mod_dv_concatenated := paste0(mod, dv)] - if (any(duplicated(dt[, mod_dv_concatenated]))) { + if (any(duplicated(dt[, mod_dv_concatenated])) & + jitter_x_y_percent == 0) { jitter_x_y_percent <- 2 kim::pm( "Because at least one pair of dots overlapped, ", @@ -381,8 +382,10 @@ floodlight_2_by_continuous <- function( " (of the observed range).") } # add jitter - if (jitter_x_y_percent > 0) { + if (jitter_x_percent == 0 & jitter_x_y_percent > 0) { jitter_x_percent <- jitter_x_y_percent + } + if (jitter_y_percent == 0 & jitter_x_y_percent > 0) { jitter_y_percent <- jitter_x_y_percent } g1 <- g1 + ggplot2::geom_point( diff --git a/R/scatterplot.R b/R/scatterplot.R index e08f181..22bc871 100644 --- a/R/scatterplot.R +++ b/R/scatterplot.R @@ -215,7 +215,8 @@ scatterplot <- function( } # add jitter and set alpha if any pair of dots overlap dt02[, x_y_concatenated := paste0(x, y)] - if (any(duplicated(dt02[, x_y_concatenated]))) { + if (any(duplicated(dt02[, x_y_concatenated])) & + jitter_x_y_percent == 0) { jitter_x_y_percent <- 2 alpha <- 0.4 kim::pm( @@ -226,8 +227,10 @@ scatterplot <- function( alpha, ").") } # add jitter - if (jitter_x_y_percent > 0) { + if (jitter_x_percent == 0 & jitter_x_y_percent > 0) { jitter_x_percent <- jitter_x_y_percent + } + if (jitter_y_percent == 0 & jitter_x_y_percent > 0) { jitter_y_percent <- jitter_x_y_percent } if (jitter_x_percent > 0 | jitter_y_percent > 0) { diff --git a/inst/CITATION b/inst/CITATION index 36144f2..626bea1 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -5,12 +5,12 @@ bibentry( title = "kim: A Toolkit for Behavioral Scientists", author = "Jin Kim", year = "2024", - note = "R package version 0.5.422", + note = "R package version 0.5.423", howpublished = "url{https://jinkim.science/docs/kim.pdf}", url = "https://cran.r-project.org/package=kim", textVersion = paste0( "Jin Kim (2024). ", "kim: A Toolkit for Behavioral Scientists. ", - "R package version 0.5.422" + "R package version 0.5.423" ) )