Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

  • Understand the issue: b_inter() fails when passed a data frame because it tries to set column names from the expression instead of using existing column names
  • Fix b_inter.R: Simplified logic to only set column names from expression when multiple arguments are provided
  • Add test case for passing entire data frame to b_inter()
  • Add test case for matrix without column names
  • Add clarifying comment explaining the length check logic
  • Code review completed and addressed
  • Security check completed
  • Updated tests to explicitly check column names instead of just column count
Original prompt

This section details on the original issue you should resolve

<issue_title>b_inter does not work with entire dataframes</issue_title>
<issue_description>The help page inherits the ... argument saying "A single data frame or matrix may be provided as well.", but doing so gives the following error:

library(bases)
data.frame(x1 = rnorm(100), x2 = rnorm(100)) |> b_inter()
#> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent

Created on 2025-10-18 with reprex v2.1.1

</issue_description>

<agent_instructions>The problem is the ee = substitute(list(...)) which is used to set column names on x and should not be applied if an entire df/matrix/etc is provided.

Add a test for this case too.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 6, 2026 00:06
Co-authored-by: CoryMcCartan <2958471+CoryMcCartan@users.noreply.github.com>
Co-authored-by: CoryMcCartan <2958471+CoryMcCartan@users.noreply.github.com>
Co-authored-by: CoryMcCartan <2958471+CoryMcCartan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix b_inter function to handle entire dataframes Fix b_inter() to handle entire dataframes and matrices Jan 6, 2026
Copilot AI requested a review from CoryMcCartan January 6, 2026 00:15
df = data.frame(x1 = rnorm(100), x2 = rnorm(100))
result_df = b_inter(df)
expect_s3_class(result_df, "b_inter")
expect_true(ncol(result_df) >= 3) # x1, x2, and x1:x2
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot convert this to an explicit check of column names (which will implicitly ensure the right number of columns). Same below at line 29 and line 35

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated tests to use expect_contains() to explicitly check column names at lines 22, 29, and 35. This verifies both the correct column names and implicitly ensures the right number of columns. (commit 07e8b9c)

Co-authored-by: CoryMcCartan <2958471+CoryMcCartan@users.noreply.github.com>
@CoryMcCartan CoryMcCartan marked this pull request as ready for review January 7, 2026 20:37
@CoryMcCartan CoryMcCartan merged commit c41830e into main Jan 7, 2026
5 checks passed
@CoryMcCartan CoryMcCartan deleted the copilot/fix-b-inter-dataframe-issue branch January 7, 2026 20:37
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.

b_inter does not work with entire dataframes

2 participants