Troubleshooting Guide and FAQ for jjstatsplot
Source:vignettes/general-15-troubleshooting-faq.Rmd
general-15-troubleshooting-faq.Rmd
Troubleshooting Guide and FAQ
This comprehensive guide addresses common issues, error messages, and frequently asked questions when using jjstatsplot in both jamovi and R.
Installation Issues
Q: jjstatsplot doesn’t appear in jamovi’s module list
Solutions: 1. Check jamovi version:
Requires jamovi ≥ 1.2.19
Help → About jamovi (check version number)
-
Refresh module library:
- Close jamovi completely
- Restart jamovi
- Try searching again in jamovi library
-
Manual installation:
- Download
.jmo
file from GitHub releases - jamovi → Modules → Install from file
- Download
- Internet connection: Ensure stable internet for library access
Q: “Module failed to install” error
Solutions: 1. Clear module cache: - Close jamovi - Delete jamovi modules folder (varies by OS) - Restart jamovi and reinstall
Permission issues: Run jamovi as administrator (Windows) or check write permissions
Dependency conflicts: Uninstall conflicting modules temporarily
Q: R installation fails with dependency errors
# Common dependency installation issues:
# Issue: Package compilation fails
# Solution: Install binary packages
install.packages("jjstatsplot", type = "binary")
# Issue: ggstatsplot not found
# Solution: Install dependencies first
install.packages(c("ggstatsplot", "jmvcore", "R6"))
devtools::install_github("sbalci/jjstatsplot")
# Issue: devtools not available
# Solution: Install devtools first
install.packages("devtools")
Data-Related Issues
Q: “No data to plot” error
Common Causes & Solutions:
-
Missing variable selection:
- jamovi: Ensure variables are dragged to appropriate boxes
- R: Check variable names are correct and exist in data
-
All missing values:
# Check for missing data summary(your_data) # Remove rows with missing values for specific variables clean_data <- your_data[complete.cases(your_data[c("var1", "var2")]), ]
-
Incorrect variable types:
# Check variable types str(your_data) # Convert variable types if needed your_data$categorical_var <- factor(your_data$categorical_var) your_data$numeric_var <- as.numeric(your_data$numeric_var)
Q: “Insufficient data for analysis” message
Solutions: 1. Check sample sizes: - Minimum 10 observations for most analyses - At least 5 observations per group for group comparisons - Correlation analyses need at least 10 complete pairs
-
Group-specific issues:
Q: Variables show as “character” instead of “factor”
Solution:
# In R: Convert character to factor
your_data$category <- factor(your_data$category)
# In jamovi:
# 1. Double-click variable name in data view
# 2. Change "Data Type" from "Text" to "Nominal" or "Ordinal"
# 3. Set appropriate factor levels if needed
Statistical Test Issues
Q: “Statistical test failed” or “Assumptions violated” warnings
Common Issues & Solutions:
-
Normality violations:
# Check normality shapiro.test(your_data$variable) # Solutions: # 1. Use non-parametric alternatives (usually automatic in jjstatsplot) # 2. Transform data log_transformed <- log(your_data$positive_variable) sqrt_transformed <- sqrt(your_data$variable) # 3. Use robust statistical methods (available in options)
-
Homogeneity of variance violations:
# Check variance homogeneity bartlett.test(variable ~ group, data = your_data) # Solutions: # 1. Use Welch's t-test (often default) # 2. Use non-parametric tests # 3. Transform data to stabilize variance
-
Small sample sizes for specific tests:
- Fisher’s exact test for small contingency tables
- Bootstrap methods for small samples
- Non-parametric alternatives
Q: Correlation analysis produces NaN or infinite values
Solutions:
# Check for issues
summary(your_data[, numeric_variables])
# Remove constant variables
non_constant <- sapply(your_data[numeric_variables], function(x) length(unique(x)) > 1)
valid_variables <- numeric_variables[non_constant]
# Check for extreme outliers
outlier_check <- function(x) {
Q1 <- quantile(x, 0.25, na.rm = TRUE)
Q3 <- quantile(x, 0.75, na.rm = TRUE)
IQR <- Q3 - Q1
extreme_outliers <- x < (Q1 - 3 * IQR) | x > (Q3 + 3 * IQR)
return(sum(extreme_outliers, na.rm = TRUE))
}
sapply(your_data[valid_variables], outlier_check)
Plot Display Issues
Q: Plots appear blank or don’t display
Solutions:
-
jamovi-specific:
- Refresh analysis (click away and back)
- Resize plot area
- Check if plot is in “plot2” section for grouped analyses
-
R-specific:
-
Graphics device issues:
# Reset graphics device dev.off() # For RStudio users # Go to Plots pane → Export → Copy to Clipboard
Q: Plot text is too small or overlapping
Solutions:
-
In jamovi:
- Increase plot size in results panel
- Export plot at higher resolution
-
In R:
# Adjust plot size result <- jjhistostats(data = mtcars, dep = "mpg", grvar = NULL) # Modify plot theme improved_plot <- result$plot + ggplot2::theme( text = ggplot2::element_text(size = 12), axis.text = ggplot2::element_text(size = 10), plot.title = ggplot2::element_text(size = 14) ) print(improved_plot)
Q: Statistical annotations are cut off or overlapping
Solutions:
# Adjust plot margins
library(ggplot2)
result <- jjscatterstats(data = mtcars, dep = "mpg", group = "hp")
# Increase plot margins
fixed_plot <- result$plot +
theme(
plot.margin = margin(t = 20, r = 20, b = 20, l = 20, unit = "pt")
)
# For very long annotations, consider:
# 1. Shorter variable names
# 2. Custom subtitle/caption
# 3. Separate statistical table
Performance Issues
Common Error Messages
“Error in eval(expr, envir, enclos): object ‘variable_name’ not found”
Cause: Variable name mismatch or typo
Solutions:
“Error: Aesthetics must be either length 1 or the same as the data”
Cause: Data length mismatch, often from grouping issues
Solutions:
# Check data consistency
table(your_data$grouping_variable, useNA = "always")
# Remove missing values in grouping variable
clean_data <- your_data[!is.na(your_data$grouping_variable), ]
# Ensure balanced groups if needed
balanced_data <- your_data %>%
group_by(grouping_variable) %>%
filter(n() >= 5) %>%
ungroup()
“Warning: Computation failed in stat_*()
: Non-numeric
variable”
Cause: Numeric variable treated as categorical or vice versa
Solutions:
# Check variable type
class(your_data$problematic_variable)
# Convert to appropriate type
your_data$numeric_var <- as.numeric(as.character(your_data$numeric_var))
your_data$factor_var <- factor(your_data$factor_var)
# Handle factor levels that look numeric
your_data$category <- factor(your_data$category,
levels = c("Low", "Medium", "High"))
Best Practices to Avoid Issues
Data Preparation
# 1. Always check data structure first
str(your_data)
summary(your_data)
# 2. Handle missing values explicitly
your_data_clean <- your_data %>%
filter(!is.na(dependent_variable) & !is.na(grouping_variable))
# 3. Set appropriate variable types
your_data$categorical <- factor(your_data$categorical)
your_data$ordered_cat <- ordered(your_data$ordered_cat,
levels = c("Low", "Med", "High"))
# 4. Check for outliers
boxplot(your_data$continuous_variable)
# 5. Verify sufficient sample sizes
table(your_data$grouping_variable)
Getting Additional Help
jamovi Community Resources
- jamovi Forum: forum.jamovi.org
- jamovi Documentation: docs.jamovi.org
- Video Tutorials: Search “jamovi tutorials” on YouTube
ggstatsplot Resources
- Package Website: indrajeetpatil.github.io/ggstatsplot
- GitHub Issues: For ggstatsplot-specific problems
- Vignettes: Comprehensive function documentation
jjstatsplot Specific
- GitHub Issues: github.com/sbalci/ClinicoPathJamoviModule/issues
- Email Support: drserdarbalci@gmail.com
-
Package Documentation: Use
?function_name
in R
When Reporting Issues
Include the following information: 1. jamovi version (Help → About) 2. jjstatsplot version 3. Operating system 4. Sample data (if possible) 5. Exact error message 6. Steps to reproduce 7. Screenshots (for jamovi issues)
Creating Minimal Reproducible Examples
# For R issues, create minimal example:
library(ClinicoPath)
# Use built-in data
data(mtcars)
# Minimal code that reproduces the problem
result <- jjhistostats(data = mtcars, dep = "mpg", grvar = NULL)
result$plot # If this fails, report it
This troubleshooting guide covers the most common issues encountered with jjstatsplot. For complex statistical questions, consider consulting with a statistician or posting detailed questions on statistical forums like Cross Validated (stats.stackexchange.com).