Package 'visvaR'

Title: Shiny-Based Statistical Solutions for Agricultural Research
Description: Visualize Variance is an intuitive 'shiny' applications tailored for agricultural research data analysis, including one-way and two-way analysis of variance, correlation, and other essential statistical tools. Users can easily upload their datasets, perform analyses, and download the results as a well-formatted document, streamlining the process of data analysis and reporting in agricultural research.The experimental design methods are based on classical work by Fisher (1925) and Scheffe (1959). The correlation visualization approaches follow methods developed by Wei & Simko (2021) and Friendly (2002) <doi:10.1198/000313002533>.
Authors: Ramesh Ramasamy [aut, cre, cph] , Mathiyarasi Kulandaivadivel [ctb], Tamilselvan Arumugam [ctb]
Maintainer: Ramesh Ramasamy <[email protected]>
License: AGPL (>= 3)
Version: 1.0.0
Built: 2025-02-15 03:10:14 UTC
Source: https://github.com/rameshram96/visvar

Help Index


Function to make sure necessary fonts are imported from system

Description

function to make sure that extrafont package is installed properly and fonts are imported and loaded to be used in the pacakge

Usage

check_extrafont()

Details

function to make sure that extrafont package is installed properly and fonts are imported and loaded to be used in the pacakge

To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().


Run the Shiny App for Correlation Analysis of multiple variables

Description

App allows user to import data through excel/.csv files or through clipboard and select the correlation method and download the results with few customization options

Usage

correlation_multi

Details

This Shiny app is part of the visvaR package and is designed for correlation analysis and user can download the report in word format also has option to download the correlation plot as .png file. To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().

Value

This function runs a local instance of the Shiny app in your default web browser. The app interface allows users to upload data, select analysis methods, and download outputs.

Author(s)

Ramesh Ramasamy

Mathiyarsai Kulandaivadivel

Tamilselvan Arumugam

References

Wei, T., & Simko, V. (2021). R package 'corrplot': Visualization of a Correlation Matrix (Version 0.92). Available from https://CRAN.R-project.org/package=corrplot. Friendly, M. (2002). Corrgrams: Exploratory displays for correlation matrices. The American Statistician, 56(4), 316-324.

Examples

# Example 1: Basic usage
if(interactive()) {
  correlation_multi()
}

# Example 2: Sample workflow with iris dataset
if(interactive()) {
  # Prepare sample data
  write.csv(iris[, 1:4], "sample_data.csv", row.names = FALSE)

  # Launch the app
  correlation_multi()

  # Instructions for users:
  # 1. Click "Choose a file" and select sample_data.csv
  # 2. Select correlation method (e.g., "pearson")
  # 3. Click "Analyze"
  # 4. View results in different tabs
  # 5. Download plot or Word report as needed

  # Clean up
  unlink("sample_data.csv")
}

# Example 3: Using clipboard data
if(interactive()) {
  # Copy this to clipboard:
  # Var1,Var2,Var3
  # 1,2,3
  # 4,5,6
  # 7,8,9

  correlation_multi()
  # Click "Paste from Clipboard" after copying data
}

Run the Shiny App for performing one-way ANOVA on data from a completely randomized design.

Description

App allows user to import data through excel/.csv files or through clipboard and user can select the post-hoc test method and download the report which contains anova results and plots

Usage

oneway_crd()

Details

This Shiny app is part of the visvaR package and is designed for analysis of variance on data from completely randomized design (one factor) and user can download the report in word format. The analysis of variance was performed using R's aov() function (Chambers & Hastie, 1992; R Core Team, 2024), which implements the classical ANOVA methodology developed by Fisher (1925).To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().

Value

This function runs a local instance of the Shiny app in your default web browser. The app interface allows users to upload data, select analysis method, and download outputs.

Author(s)

Ramesh Ramasamy

Mathiyarsai Kulandaivadivel

Tamilselvan Arumugam

References

Fisher, R. A. (1925). Statistical Methods for Research Workers. Oliver and Boyd, Edinburgh. Scheffe, H. (1959). The Analysis of Variance. John Wiley & Sons, New York. R Core Team (2024). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/

Examples

# Example 1: Basic usage
if(interactive()) {
  oneway_crd()
}

# Example 2: Sample workflow with plant growth experiment
if(interactive()) {
  # Prepare sample data
  plant_data <- data.frame(
    Treatment = rep(c("Control", "Low", "Medium", "High"), each = 3),
    Replication = rep(1:3, times = 4),
    Plant_Height = c(25.3, 24.8, 25.1,  # Control
                     27.6, 28.1, 27.9,  # Low
                     30.2, 29.8, 30.5,  # Medium
                     26.8, 27.2, 26.5), # High
    Leaf_Count = c(8, 7, 8,    # Control
                   10, 11, 10,  # Low
                   12, 13, 12,  # Medium
                   9, 8, 9)     # High
  )

  # Save as Excel file
  write.xlsx(plant_data, "plant_data.xlsx")

  # Launch the app
  oneway_crd()

  # Instructions for users:
  # 1. Click "Choose .xlsx or .csv" and select plant_data.xlsx
  # 2. Select post-hoc test method (e.g., "Tukey HSD")
  # 3. Customize plot appearance if desired:
  #    - Choose bar color
  #    - Select font style
  #    - Adjust font size
  # 4. Click "Analyze"
  # 5. View results in different tabs
  # 6. Download Word report

  # Clean up
  unlink("plant_data.xlsx")
}

# Example 3: Using clipboard data
if(interactive()) {
  # Copy this to clipboard:
  # Treatment,Replication,Yield
  # Control,1,45.2
  # Control,2,44.8
  # Control,3,45.5
  # Treatment1,1,48.6
  # Treatment1,2,49.2
  # Treatment1,3,48.9
  # Treatment2,1,52.3
  # Treatment2,2,51.8
  # Treatment2,3,52.7

  oneway_crd()
  # Click "Use Clipboard Data" after copying data
}

# Example 4: Multiple response variables
if(interactive()) {
  # Create data with multiple responses
  multi_response_data <- data.frame(
    Treatment = rep(c("Control", "Treatment1", "Treatment2"), each = 4),
    Replication = rep(1:4, times = 3),
    Height = rnorm(12, mean = c(rep(20,4), rep(25,4), rep(30,4)), sd = 2),
    Weight = rnorm(12, mean = c(rep(50,4), rep(60,4), rep(70,4)), sd = 5),
    Length = rnorm(12, mean = c(rep(10,4), rep(12,4), rep(15,4)), sd = 1)
  )

  # Save as Excel file
  write.xlsx(multi_response_data, "multi_response.xlsx")

  # Launch the app
  oneway_crd()

  # App will analyze all response variables (Height, Weight, Length)
  # and generate separate analyses and plots for each

  # Clean up
  unlink("multi_response.xlsx")
}

# Example 5: Working with data frame in memory
if(interactive()) {
  # Create data frame
  yield_data <- data.frame(
    Variety = rep(c("V1", "V2", "V3", "V4"), each = 3),
    Replication = rep(1:3, times = 4),
    Grain_Yield = c(
      4.5, 4.7, 4.6,  # V1
      5.2, 5.0, 5.3,  # V2
      4.8, 4.9, 4.7,  # V3
      5.5, 5.4, 5.6   # V4
    )
  )

  # Save temporarily and analyze
  write.xlsx(yield_data, "temp_data.xlsx")
  oneway_crd()
  unlink("temp_data.xlsx")
}

Run the Shiny App for performing one-way ANOVA on data from a Randomized block design.

Description

App allows user to import data through excel/.csv files or through clipboard and user can select the post-hoc test method and download the report which contains anova results and plots

Usage

oneway_rbd()

Details

This Shiny app is part of the visvaR package and is designed for analysis of variance on data from randomized block design (one factor) and user can download the report in word format. The analysis of variance was performed using R's aov() function (Chambers & Hastie, 1992; R Core Team, 2024), which implements the classical ANOVA methodology developed by Fisher (1925).To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().

Value

This function runs a local instance of the Shiny app in your default web browser. The app interface allows users to upload data, select analysis method, and download outputs.

Author(s)

Ramesh Ramasamy

Mathiyarsai Kulandaivadivel

Tamilselvan Arumugam

References

Fisher, R. A. (1925). Statistical Methods for Research Workers. Oliver and Boyd, Edinburgh. Scheffe, H. (1959). The Analysis of Variance. John Wiley & Sons, New York. R Core Team (2024). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/

Examples

# Example 1: Basic usage
if(interactive()) {
  oneway_rbd()
}

# Example 2: Sample workflow with plant growth experiment
if(interactive()) {
  # Prepare sample data
  plant_data <- data.frame(
    Treatment = rep(c("Control", "Low", "Medium", "High"), each = 3),
    Replication = rep(1:3, times = 4),
    Plant_Height = c(25.3, 24.8, 25.1,  # Control
                     27.6, 28.1, 27.9,  # Low
                     30.2, 29.8, 30.5,  # Medium
                     26.8, 27.2, 26.5), # High
    Leaf_Count = c(8, 7, 8,    # Control
                   10, 11, 10,  # Low
                   12, 13, 12,  # Medium
                   9, 8, 9)     # High
  )

  # Save as Excel file
  write.xlsx(plant_data, "plant_data.xlsx")

  # Launch the app
  oneway_rbd()

  # Instructions for users:
  # 1. Click "Choose .xlsx or .csv" and select plant_data.xlsx
  # 2. Select post-hoc test method (e.g., "Tukey HSD")
  # 3. Customize plot appearance if desired:
  #    - Choose bar color
  #    - Select font style
  #    - Adjust font size
  # 4. Click "Analyze"
  # 5. View results in different tabs
  # 6. Download Word report

  # Clean up
  unlink("plant_data.xlsx")
}

# Example 3: Using clipboard data
if(interactive()) {
  # Copy this to clipboard:
  # Treatment,Replication,Yield
  # Control,1,45.2
  # Control,2,44.8
  # Control,3,45.5
  # Treatment1,1,48.6
  # Treatment1,2,49.2
  # Treatment1,3,48.9
  # Treatment2,1,52.3
  # Treatment2,2,51.8
  # Treatment2,3,52.7

  oneway_rbd()
  # Click "Use Clipboard Data" after copying data
}

# Example 4: Multiple response variables
if(interactive()) {
  # Create data with multiple responses
  multi_response_data <- data.frame(
    Treatment = rep(c("Control", "Treatment1", "Treatment2"), each = 4),
    Replication = rep(1:4, times = 3),
    Height = rnorm(12, mean = c(rep(20,4), rep(25,4), rep(30,4)), sd = 2),
    Weight = rnorm(12, mean = c(rep(50,4), rep(60,4), rep(70,4)), sd = 5),
    Length = rnorm(12, mean = c(rep(10,4), rep(12,4), rep(15,4)), sd = 1)
  )

  # Save as Excel file
  write.xlsx(multi_response_data, "multi_response.xlsx")

  # Launch the app
  oneway_rbd()
  }

Run the Shiny App for performing two-way ANOVA on data from a completely randomized design.

Description

App allows user to import data through excel/.csv files or through clipboard and user can select the post-hoc test method and download the report which contains anova results and plots

Usage

twoway_crd()

Details

This Shiny app is part of the visvaR package and is designed for analysis of variance on data from completely randomized design (two factor) and user can download the report in word format. The analysis of variance was performed using R's aov() function (Chambers & Hastie, 1992; R Core Team, 2024), which implements the classical ANOVA methodology developed by Fisher (1925). To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().

Value

This function runs a local instance of the Shiny app in your default web browser. The app interface allows users to upload data, select analysis method, and download outputs.

Author(s)

Ramesh Ramasamy

Mathiyarsai Kulandaivadivel

Tamilselvan Arumugam

References

Fisher, R. A. (1925). Statistical Methods for Research Workers. Oliver and Boyd, Edinburgh. Scheffe, H. (1959). The Analysis of Variance. John Wiley & Sons, New York. R Core Team (2024). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/

Examples

# Example 1: Basic usage
if(interactive()) {
  twoway_crd()
}

# Example 2: Sample workflow with factorial fertilizer experiment
if(interactive()) {
  # Prepare sample data with two factors: Nitrogen and Phosphorus levels
  fertilizer_data <- data.frame(
    Nitrogen = rep(c("N0", "N30", "N60"), each = 12),
    Phosphorus = rep(rep(c("P0", "P30", "P60", "P90"), each = 3), times = 3),
    Replication = rep(1:3, times = 12),
    Grain_Yield = c(
      4.2, 4.0, 4.1,  # N0-P0
      4.8, 4.6, 4.7,  # N0-P30
      5.1, 5.0, 5.2,  # N0-P60
      5.0, 4.9, 5.1,  # N0-P90
      5.5, 5.3, 5.4,  # N30-P0
      6.2, 6.0, 6.1,  # N30-P30
      6.8, 6.6, 6.7,  # N30-P60
      6.7, 6.5, 6.6,  # N30-P90
      6.0, 5.8, 5.9,  # N60-P0
      6.8, 6.6, 6.7,  # N60-P30
      7.5, 7.3, 7.4,  # N60-P60
      7.4, 7.2, 7.3   # N60-P90
    ),
    Protein_Content = c(
      9.0, 8.8, 8.9,   # N0-P0
      9.5, 9.3, 9.4,   # N0-P30
      9.8, 9.6, 9.7,   # N0-P60
      9.7, 9.5, 9.6,   # N0-P90
      10.5, 10.3, 10.4, # N30-P0
      11.2, 11.0, 11.1, # N30-P30
      11.8, 11.6, 11.7, # N30-P60
      11.7, 11.5, 11.6, # N30-P90
      12.0, 11.8, 11.9, # N60-P0
      12.8, 12.6, 12.7, # N60-P30
      13.5, 13.3, 13.4, # N60-P60
      13.4, 13.2, 13.3  # N60-P90
    )
  )

  # Save as Excel file
  write.xlsx(fertilizer_data, "fertilizer_data.xlsx")

  # Launch the app
  twoway_crd()

  # Instructions for users:
  # 1. Click "Choose .xlsx or .csv" and select fertilizer_data.xlsx
  # 2. Select post-hoc test method (e.g., "LSD" or "Tukey HSD")
  # 3. Customize plot appearance:
  #    - Select font style
  #    - Adjust font size
  # 4. Set output filename
  # 5. Click "Analyze"
  # 6. View results in different tabs
  # 7. Download comprehensive Word report

  # Clean up
  unlink("fertilizer_data.xlsx")
}

# Example 3: Using clipboard data
if(interactive()) {
  # Copy this to clipboard:
  # Temperature,Light,Replication,Growth_Rate,Chlorophyll
  # Low,Dark,1,2.1,15.2
  # Low,Dark,2,2.0,15.0
  # Low,Dark,3,2.2,15.1
  # Low,Medium,1,2.8,16.5
  # Low,Medium,2,2.7,16.3
  # Low,Medium,3,2.9,16.4
  # Low,High,1,3.2,17.8
  # Low,High,2,3.1,17.6
  # Low,High,3,3.3,17.7
  # High,Dark,1,2.5,14.8
  # High,Dark,2,2.4,14.6
  # High,Dark,3,2.6,14.7
  # High,Medium,1,3.5,16.2
  # High,Medium,2,3.4,16.0
  # High,Medium,3,3.6,16.1
  # High,High,1,4.2,17.5
  # High,High,2,4.1,17.3
  # High,High,3,4.3,17.4

  twoway_crd()
  # Click "Use Clipboard Data" after copying data
}

# Example 4: Multiple response variables with variety trial
if(interactive()) {
  # Create data with multiple responses
  variety_trial <- data.frame(
    Irrigation = rep(c("Full", "Deficit"), each = 18),
    Variety = rep(rep(c("V1", "V2", "V3"), each = 6), times = 2),
    Replication = rep(1:6, times = 6),
    Yield = rnorm(36, mean = rep(c(5.5, 5.0, 4.8, 4.2, 3.8, 3.5), each = 6), sd = 0.2),
    WUE = rnorm(36, mean = rep(c(2.2, 2.4, 2.3, 2.8, 3.0, 2.9), each = 6), sd = 0.1),
    Biomass = rnorm(36, mean = rep(c(12.5, 11.8, 11.2, 10.2, 9.8, 9.5), each = 6), sd = 0.5)
  )

  # Save as Excel file
  write.xlsx(variety_trial, "variety_trial.xlsx")

  # Launch the app
  twoway_crd()

  # Clean up
  unlink("variety_trial.xlsx")
}

Run the Shiny App for performing one-way ANOVA on data from a Randomized block design

Description

App allows user to import data through excel/.csv files or through clipboard and user can select the post-hoc test method and download the report which contains anova results and plots

Usage

twoway_rbd()

Details

This Shiny app is part of the visvaR package and is designed for analysis of variance randomized block design (two factor) and user can download the report in word format.To use custom fonts, please install the extrafont package and run extrafont::font_import() and extrafont::loadfonts().

Value

This function runs a local instance of the Shiny app in your default web browser. The app interface allows users to upload data, select analysis method, and download outputs.

Author(s)

Ramesh Ramasamy

Mathiyarsai Kulandaivadivel

Tamilselvan Arumugam

References

Fisher, R. A. (1925). Statistical Methods for Research Workers. Oliver and Boyd, Edinburgh. Scheffe, H. (1959). The Analysis of Variance. John Wiley & Sons, New York. R Core Team (2024). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/

Examples

# Example 1: Basic usage
if(interactive()) {
  twoway_rbd()
}

# Example 2: Sample workflow with factorial fertilizer experiment
if(interactive()) {
  # Prepare sample data with two factors: Nitrogen and Phosphorus levels
  fertilizer_data <- data.frame(
    Nitrogen = rep(c("N0", "N30", "N60"), each = 12),
    Phosphorus = rep(rep(c("P0", "P30", "P60", "P90"), each = 3), times = 3),
    Replication = rep(1:3, times = 12),
    Grain_Yield = c(
      4.2, 4.0, 4.1,  # N0-P0
      4.8, 4.6, 4.7,  # N0-P30
      5.1, 5.0, 5.2,  # N0-P60
      5.0, 4.9, 5.1,  # N0-P90
      5.5, 5.3, 5.4,  # N30-P0
      6.2, 6.0, 6.1,  # N30-P30
      6.8, 6.6, 6.7,  # N30-P60
      6.7, 6.5, 6.6,  # N30-P90
      6.0, 5.8, 5.9,  # N60-P0
      6.8, 6.6, 6.7,  # N60-P30
      7.5, 7.3, 7.4,  # N60-P60
      7.4, 7.2, 7.3   # N60-P90
    ),
    Protein_Content = c(
      9.0, 8.8, 8.9,   # N0-P0
      9.5, 9.3, 9.4,   # N0-P30
      9.8, 9.6, 9.7,   # N0-P60
      9.7, 9.5, 9.6,   # N0-P90
      10.5, 10.3, 10.4, # N30-P0
      11.2, 11.0, 11.1, # N30-P30
      11.8, 11.6, 11.7, # N30-P60
      11.7, 11.5, 11.6, # N30-P90
      12.0, 11.8, 11.9, # N60-P0
      12.8, 12.6, 12.7, # N60-P30
      13.5, 13.3, 13.4, # N60-P60
      13.4, 13.2, 13.3  # N60-P90
    )
  )

  # Save as Excel file
  write.xlsx(fertilizer_data, "fertilizer_data.xlsx")

  # Launch the app
  twoway_rbd()

  # Instructions for users:
  # 1. Click "Choose .xlsx or .csv" and select fertilizer_data.xlsx
  # 2. Select post-hoc test method (e.g., "LSD" or "Tukey HSD")
  # 3. Customize plot appearance:
  #    - Select font style
  #    - Adjust font size
  # 4. Set output filename
  # 5. Click "Analyze"
  # 6. View results in different tabs
  # 7. Download comprehensive Word report

  # Clean up
  unlink("fertilizer_data.xlsx")
}

# Example 3: Using clipboard data
if(interactive()) {
  # Copy this to clipboard:
  # Temperature,Light,Replication,Growth_Rate,Chlorophyll
  # Low,Dark,1,2.1,15.2
  # Low,Dark,2,2.0,15.0
  # Low,Dark,3,2.2,15.1
  # Low,Medium,1,2.8,16.5
  # Low,Medium,2,2.7,16.3
  # Low,Medium,3,2.9,16.4
  # Low,High,1,3.2,17.8
  # Low,High,2,3.1,17.6
  # Low,High,3,3.3,17.7
  # High,Dark,1,2.5,14.8
  # High,Dark,2,2.4,14.6
  # High,Dark,3,2.6,14.7
  # High,Medium,1,3.5,16.2
  # High,Medium,2,3.4,16.0
  # High,Medium,3,3.6,16.1
  # High,High,1,4.2,17.5
  # High,High,2,4.1,17.3
  # High,High,3,4.3,17.4

  twoway_rbd()
  # Click "Use Clipboard Data" after copying data
}

# Example 4: Multiple response variables with variety trial
if(interactive()) {
  # Create data with multiple responses
  variety_trial <- data.frame(
    Irrigation = rep(c("Full", "Deficit"), each = 18),
    Variety = rep(rep(c("V1", "V2", "V3"), each = 6), times = 2),
    Replication = rep(1:6, times = 6),
    Yield = rnorm(36, mean = rep(c(5.5, 5.0, 4.8, 4.2, 3.8, 3.5), each = 6), sd = 0.2),
    WUE = rnorm(36, mean = rep(c(2.2, 2.4, 2.3, 2.8, 3.0, 2.9), each = 6), sd = 0.1),
    Biomass = rnorm(36, mean = rep(c(12.5, 11.8, 11.2, 10.2, 9.8, 9.5), each = 6), sd = 0.5)
  )

  # Save as Excel file
  write.xlsx(variety_trial, "variety_trial.xlsx")

  # Launch the app
  twoway_rbd()

  # Clean up
  unlink("variety_trial.xlsx")
}