Skip to contents

Enhanced two-way frequency analysis toolkit with BlueSky integration for comprehensive cross-tabulation analysis. Includes cell, row, and column percentages, statistical tests for association, robust error handling, and clinical interpretation guidance. Perfect for exploring relationships between categorical variables in clinicopathological research.

Usage

enhancedtwowayfrequency(
  data,
  rowVar,
  colVar,
  cellPercent = TRUE,
  rowPercent = FALSE,
  colPercent = FALSE,
  showCounts = TRUE,
  showTotals = TRUE,
  chiSquareTest = TRUE,
  fisherTest = FALSE,
  continuityCorrection = TRUE,
  associationMeasures = TRUE,
  residualAnalysis = FALSE,
  expectedFrequencies = FALSE,
  minimumExpected = 5,
  robustErrorHandling = TRUE,
  showDiagnostics = FALSE,
  detailedOutput = FALSE,
  clinicalInterpretation = TRUE,
  showRecommendations = FALSE,
  bluesky_integration = TRUE,
  comprehensive_output = FALSE,
  heatmapPlot = FALSE,
  mosaicPlot = FALSE,
  percentageDisplay = "percentage"
)

Arguments

data

.

rowVar

.

colVar

.

cellPercent

Display percentages of total sample (BlueSky BSkyTwoWayFrequency feature)

rowPercent

Display row-wise percentages (sum to 100 percent across rows)

colPercent

Display column-wise percentages (sum to 100 percent across columns)

showCounts

Display raw frequency counts in cross-tabulation

showTotals

Include row and column totals in tables

chiSquareTest

Perform Pearson's chi-square test for association

fisherTest

Perform Fisher's exact test (recommended for small samples)

continuityCorrection

Apply continuity correction for 2x2 tables

associationMeasures

Calculate Cramér's V, Phi coefficient, and other association measures

residualAnalysis

Calculate and display standardized residuals for detecting patterns

expectedFrequencies

Display expected frequencies under independence assumption

minimumExpected

Threshold for warning about low expected frequencies

robustErrorHandling

Use BlueSky-style error handling with graceful degradation

showDiagnostics

Display diagnostic information about computations and assumptions

detailedOutput

Include comprehensive statistical details and interpretations

clinicalInterpretation

Provide clinical context and interpretation guidance

showRecommendations

Provide recommendations based on analysis results

bluesky_integration

Use BlueSky R statistical environment features

comprehensive_output

Include comprehensive statistical details and diagnostics

heatmapPlot

Create heatmap visualization of frequency table

mosaicPlot

Create mosaic plot showing proportional relationships

percentageDisplay

Format for displaying percentage values

Value

A results object containing:

results$instructionsa html
results$observedFrequenciesa table
results$crossTabMatrixa table
results$cellPercentMatrixa table
results$rowPercentMatrixa table
results$colPercentMatrixa table
results$testResultsa table
results$associationMeasuresTablea table
results$assumptionChecka table
results$diagnosticsComputational diagnostics and data quality assessment
results$comprehensiveAnalysisSummaryEnhanced statistical summary with BlueSky integration
results$recommendationsa html
results$clinicalInterpretationGuidea html
results$methodsExplanationa html
results$heatmapPlotan image
results$mosaicPlotan image
results$residualPlotan image

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$observedFrequencies$asDF

as.data.frame(results$observedFrequencies)