Skip to content

Suggestions for various scale item functions #837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 30, 2025
Merged

Conversation

strengejacke
Copy link
Member

Fixes #836

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @strengejacke, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on extending the check_itemscale() function within the performance package. The core enhancement allows the function to process outputs from factor analysis, providing a more versatile tool for researchers to evaluate the internal consistency of scales and subscales in psychometric contexts. This change addresses issue #836.

Highlights

  • Functionality Extension: The check_itemscale() function has been significantly enhanced to accept results from parameters::factor_analysis() (objects of class parameters_efa), in addition to the previously supported parameters::principal_components() (objects of class parameters_pca). This broadens its applicability for assessing internal consistencies of subscales derived from factor analysis.
  • Documentation Updates: All relevant documentation, including the Roxygen comments within the source code and the auto-generated R documentation, has been updated to reflect the new support for parameters_efa objects and parameters::factor_analysis().
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request modifies the check_itemscale function to support factor analysis results from parameters::factor_analysis() in addition to principal component analysis results. The changes include updating the function description, parameter definitions, and error handling to accommodate the new input type. The code was reviewed and suggestions were made to improve error message clarity and code efficiency.

@strengejacke strengejacke requested a review from Copilot June 28, 2025 09:15
@strengejacke
Copy link
Member Author

@gemini-code-assist review

Copilot

This comment was marked as outdated.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances check_itemscale() and item_omega() by adding support for factor analysis objects and on-the-fly item reversal. The changes are well-documented and include tests. A critical issue was identified in R/item_omega.R where a function signature change was not fully propagated, which will cause runtime errors. Additionally, medium-severity issues were noted regarding broken documentation links and code duplication.

@strengejacke strengejacke requested a review from Copilot June 29, 2025 19:04
@strengejacke
Copy link
Member Author

@gemini-code-assist review

Copy link
Contributor

@Copilot 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 enhances the check_itemscale() function to work with parameters::factor_analysis() outputs, updates the Markdown printer to include Cronbach’s alpha and inter-item correlation footers, and removes the deprecated item_direction parameter from item_omega(). It also adds new tests (and snapshots) covering the FA path, updates documentation, and bumps the package version.

  • Support FA objects in check_itemscale() (code + docs)
  • Extend print_md() for check_itemscale() with footers and new snapshots
  • Remove item_direction parameter from item_omega() and update its documentation

Reviewed Changes

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

Show a summary per file
File Description
tests/testthat/test-model_performance.psych.R Add rotation = "none" to psych test
tests/testthat/test-check_itemscale.R Add skips and new FA tests for check_itemscale()
tests/testthat/_snaps/check_itemscale.md New snapshot for FA print_md()
man/item_omega.Rd Remove item_direction argument documentation
man/check_itemscale.Rd Update docs to include factor_analysis(); fix Rd syntax
R/print_md.R Refactor print_md.check_itemscale() to generate captions & footers
R/item_omega.R Remove item_direction from code
R/check_itemscale.R Add parameters_efa to code path and simplify checks
NEWS.md Document new FA support and footer feature
DESCRIPTION Bump version to 0.14.0.11
Comments suppressed due to low confidence (2)

tests/testthat/test-model_performance.psych.R:6

  • [nitpick] Add skip_if_not_installed("psych") and skip_if_not_installed("GPArotation") at the top of this test to avoid failures when those packages are not available.
test_that("model_performance.psych", {

man/check_itemscale.Rd:11

  • The \item{x} block is split incorrectly and the cross‐reference for factor_analysis() uses the wrong Rd topic. Merge into a single \item{x}{...} entry and use \link[parameters:factor_analysis]{parameters::factor_analysis()} for the FA reference.
\code{\link[parameters:principal_components]{parameters::principal_components()}}, of class \code{parameters_efa}, as

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances check_itemscale() to support factor analysis results. The review identifies an issue in the generated documentation where a link to parameters::factor_analysis() is incorrect.

Comment on lines 11 to 12
\code{\link[parameters:principal_components]{parameters::principal_components()}}, of class \code{parameters_efa}, as
returned by \code{\link[parameters:principal_components]{parameters::factor_analysis()}}, or a data frame.}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The link for parameters::factor_analysis() is incorrect. It points to parameters::principal_components instead of parameters::factor_analysis.

\code{\link[parameters:factor_analysis]{parameters::factor_analysis()}}, of class \code{parameters_efa}, as
returned by \code{\link[parameters:factor_analysis]{parameters::factor_analysis()}}, or a data frame.

Comment on lines 31 to 32
of \code{\link[parameters:principal_components]{parameters::principal_components()}} or
\code{\link[parameters:principal_components]{parameters::factor_analysis()}}, i.e. based on how many components were
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The link for parameters::factor_analysis() is incorrect. It points to parameters::principal_components instead of parameters::factor_analysis.

\code{\link[parameters:factor_analysis]{parameters::factor_analysis()}} or
\code{\link[parameters:factor_analysis]{parameters::factor_analysis()}}, i.e. based on how many components were

@strengejacke strengejacke merged commit 6f6769f into main Jun 30, 2025
19 of 24 checks passed
@strengejacke strengejacke deleted the strengejacke/issue836 branch June 30, 2025 04:45
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.

Suggestions for various scale item functions
1 participant