Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Monday, November 17, 2025

Animated Graph maker using R-Project-Shiny-based Packages

This animated graph maker has been developed using R-Project (4.4.1), RStudio 2025.09.1 Build 401. It is made using packages, including shiny, ggplot2, gganimate, gifski, av, dplyr, readr, shinycssloaders, gapminder, rlang, and shinyjs..

Check my other online advanced statistical tools here:

1. Structural Equation Modeling using Lavaan package in R - https://jeepakistan.blogspot.com/2025/07/structural-equation-modeling-sem-using.html

2. Meta-analysis using Odds Ratio (OR) in Microsoft Excel - https://jeepakistan.blogspot.com/2025/06/meta-analysis-using-odds-ratio-or-in.html

3. Meta-analysis using Cohen's d in Microsoft Excel - https://jeepakistan.blogspot.com/2025/05/meta-analysis-using-cohens-d-in.html

4. Meta-analysis using Correlation (r) in Microsoft Excel - https://jeepakistan.blogspot.com/2025/05/meta-analysis-using-correlation-r-in.html

5. Meta-Analysis using R-Project-based Metafor, and Online calculator (R-Project-Shiny-based) - https://jeepakistan.blogspot.com/2025/09/meta-analysis-using-r-project-based.html

6. Time Series Analyses using R-Project-based Packages, and Online calculator (R-Project-Shiny-based) - https://jeepakistan.blogspot.com/2025/10/time-series-analyses-using-r-project.html

Wednesday, September 10, 2025

Meta-Analysis using R-Project-based Metafor, and Online calculator (R-Project-Shiny-based)

This online calculator has been developed using R-Project (4.4.1), RStudio 2025.05.0 Build 496. It is made using packages, including shiny, shinydashboard, metafor, readr, DT, ggplot2, plotly, broom, and rmarkdown.. Powered by the metafor R package: Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1-48. Terms of Use and Disclaimer: This tool is for educational purposes only. The author assumes no liability for inaccuracies or decisions made based on this output. No data is stored on our servers. The Meta-Analysis Toolkit provided on this site is an open-source tool intended for exploratory data analysis. Users are encouraged to verify all results with primary statistical software before publication. The owner of JeePakistan.blogspot.com is not responsible for any research outcomes derived from this tool.

Check my other online advanced statistical tools here:

1. Structural Equation Modeling using Lavaan package in R - https://jeepakistan.blogspot.com/2025/07/structural-equation-modeling-sem-using.html

2. Meta-analysis using Odds Ratio (OR) in Microsoft Excel - https://jeepakistan.blogspot.com/2025/06/meta-analysis-using-odds-ratio-or-in.html

3. Meta-analysis using Cohen's d in Microsoft Excel - https://jeepakistan.blogspot.com/2025/05/meta-analysis-using-cohens-d-in.html

4. Meta-analysis using Correlation (r) in Microsoft Excel - https://jeepakistan.blogspot.com/2025/05/meta-analysis-using-correlation-r-in.html

Saturday, November 16, 2024

Day 6: 30-days to learn rgl, plotly, and gganimate - Create an interactive 3D plot with rgl that uses various viewpoints or angles to simulate rotation

rglWebGL


Step 1: Install and Load the rgl Package

Ensure that you have the rgl package installed and loaded in your R environment.

# Install rgl if not already installed
if (!require("rgl")) install.packages("rgl")
 
# Load the rgl package
library(rgl)

Step 2: Prepare a Dataset

For demonstration purposes, create or use a sample 3D dataset (e.g., random points in 3D space).

# Sample dataset with random 3D points
set.seed(123)
n <- 100
x <- rnorm(n)
y <- rnorm(n)
z <- rnorm(n)
colors <- rainbow(n)

Step 3: Create a Basic 3D Plot

Use plot3d() to create a basic 3D scatter plot.

# Create a 3D scatter plot
plot3d(x, y, z, col = colors, size = 5, type = 's', xlab = "X-axis", ylab = "Y-axis", zlab = "Z-axis")

Step 4: Enhance the Plot with Customization

Add customizations like grid lines, labels, and lighting for better visualization.

# Add grid lines
grid3d("x")
grid3d("y")
grid3d("z")
 
# Enhance lighting
light3d(specular = "white")

Step 5: Set Up Rotation Parameters

Define a sequence of angles to rotate the plot and simulate a continuous rotation.

# Define rotation parameters
angles <- seq(0, 360, by = 5) # 5-degree increments

Step 6: Rotate the Plot Programmatically

Use a loop to rotate the plot around a specific axis (e.g., the z-axis).

# Rotate around the z-axis
for (angle in angles) {
  view3d(theta = angle, phi = 30) # Rotate theta; phi is the vertical angle
  Sys.sleep(0.1)                 # Pause for 0.1 seconds for smooth transition
}

Step 7: Export the Visualization

Save the interactive 3D plot as an HTML widget or image file for sharing or further use.

# Save as an interactive HTML file
rglwidget() %>% htmlwidgets::saveWidget("3D_plot_rotation.html")
 
# Save as a static image (PNG)
rgl.snapshot("3D_plot_rotation.png")

Step 8: Test and Adjust

  • Experiment with different rotation axes (x, y, or z) by modifying view3d() parameters.
  • Adjust the speed of rotation using Sys.sleep().

Outcome

By the end of this exercise, you will have an interactive 3D plot that smoothly rotates, providing a dynamic visualization of the data. You can integrate this plot with tools like plotly or embed it into web presentations for a polished output.


Bayes' Theorem - Educational Content