Skip to content

Conversation

@strengejacke
Copy link
Member

Fixes #652

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 fixes a bug in the data_replicate() function where it would fail with an "invalid 'times'" error when only one column remained in the data frame after removing the expand column. The fix adds the drop = FALSE parameter to prevent automatic dimension dropping during row subsetting.

  • Adds drop = FALSE to row subsetting operation to preserve data frame structure
  • Includes regression test to verify the fix works for single-column scenarios
  • Updates version number and NEWS.md with bug fix documentation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
R/data_replicate.R Adds drop = FALSE to prevent dimension dropping when subsetting rows
tests/testthat/test-data_replicate.R Adds regression test for single-column data frame handling
NEWS.md Documents the bug fix in release notes
DESCRIPTION Increments version number from 1.2.0.5 to 1.2.0.6

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@etiennebacher etiennebacher left a comment

Choose a reason for hiding this comment

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

LGTM, you can merge if tests pass. Thank you

@strengejacke
Copy link
Member Author

I added it also in two other instances.
What about data[!duplicated(data$temporary_id2), ] in data_unique()?

@etiennebacher

This comment was marked as outdated.

@etiennebacher
Copy link
Member

My bad, I'm wrong

What about data[!duplicated(data$temporary_id2), ] in data_unique()?

This probably needs to be fixed too.

@strengejacke

This comment was marked as outdated.

@strengejacke strengejacke merged commit d85088c into main Sep 8, 2025
25 checks passed
@strengejacke strengejacke deleted the sj_issue_652 branch September 8, 2025 22:16
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.

data_replicate will fail with invalid 'times' value when only one column is left in data frame

3 participants