Skip to content

Conversation

@martinctc
Copy link
Owner

Description

This PR prepares the tstoolbox package for CRAN release.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring (no functional changes)

Related Issues

Checklist

Code Quality

  • My code follows the tidyverse style guide
  • I have commented my code where necessary
  • I have made corresponding changes to the documentation

Documentation

  • I have added/updated roxygen2 documentation for any new/changed functions
  • I have added @examples for new exported functions
  • I have updated the README if needed
  • I have added a bullet to NEWS.md describing the changes

Testing

  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally with my changes

R CMD check

  • devtools::check() passes with 0 errors, 0 warnings, and 0 notes

Additional Notes

- Implement `concordance()` to calculate the concordance index for co-movement between two time series.
- Introduce `direction_leadlag()` to detect lead-lag relationships and identify optimal lags in directional co-movement.
- Create `direction_test()` to test the statistical significance of co-movement between two time series using various methods.
- Add `rolling_direction()` to compute the rolling co-movement proportion over a specified window.
- Develop `plot_rolling_direction()` for visualizing rolling co-movement with optional colored bands.
- Document all new functions with corresponding examples and details in the man pages.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares the tstoolbox R package for its initial CRAN submission (version 0.1.0). The package provides comprehensive tools for time series co-movement analysis and diagnostics, with a focus on directional co-movement — measuring when series rise and fall in sync.

Changes:

  • Added comprehensive documentation including two vignettes, updated README, and complete roxygen documentation for all functions
  • Implemented new co-movement analysis functions (rolling_direction, direction_test, direction_leadlag, concordance, asymmetric_direction)
  • Added visualization functions (plot_rolling_direction, plot_xcf enhancements)
  • Updated package metadata for CRAN compliance (LICENSE, DESCRIPTION, NAMESPACE)

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
DESCRIPTION Updated package metadata with proper Authors@R format, MIT license, improved description, and complete dependency list
LICENSE Added MIT license with copyright holder and year
NEWS.md Added changelog documenting all functions for version 0.1.0
NAMESPACE Updated with new exports and imports for all new functions
README.md Significantly expanded with comprehensive overview, function reference table, and examples
vignettes/introduction-to-comovement.Rmd New comprehensive vignette covering co-movement analysis workflow
vignettes/additional-tools.Rmd New vignette covering cross-correlation, adstock, and utility functions
R/*.R Added new functions and improved documentation with roxygen2 for existing functions
man/*.Rd Generated documentation files with examples and complete parameter descriptions
.gitignore, .Rbuildignore, .github/PULL_REQUEST_TEMPLATE.md Added configuration files for development workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +175 to +177
plot(stocks$date, roll, type = "l",
ylim = c(0.3, 1),
main = paste("Window =", w, "days"),
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is inconsistent. Line 176 has only 1 space of indentation while line 177 has 7 spaces. This should be corrected to have consistent indentation (typically 2 or 4 spaces for continuation lines within a function call).

Copilot uses AI. Check for mistakes.
#' ("correlations go to 1 in a crisis").
#'
#' The function:
#' 1
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation has an incomplete numbered list. Line 29 shows "1" without any corresponding text, and then jumps to items 2 and 3. This will cause rendering issues in the documentation. Add the missing text for step 1 (likely "Identifies upturn and downturn periods based on the reference series" or similar).

Suggested change
#' 1
#' 1. Identifies upturn and downturn periods based on the reference series

Copilot uses AI. Check for mistakes.
martinctc and others added 6 commits January 29, 2026 11:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants