Skip to content

Conversation

@feddelegrand7
Copy link
Contributor

@feddelegrand7 feddelegrand7 commented Sep 23, 2025

Summary by CodeRabbit

  • Documentation
    • Added a new, comprehensive R Best Practices guide covering project/package structure, naming conventions, coding style, testing, performance, reproducibility, collaboration, Shiny apps, and dependency management.
    • Linked the R Best Practices guide from the Language-Specific section for easier discovery (appears in two places).
    • Clarified and unified R development guidance for consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

Adds a new R best-practices rules file under rules/ and updates README.md with two links to that rules entry in the Language-Specific section. No code, API, or behavioral changes.

Changes

Cohort / File(s) Summary of Changes
Documentation
README.md
Added two entries linking to the R Best Practices rules in the Language-Specific section.
Rules: R Best Practices
rules/r-cursorrules-prompt-file-best-practices/.cursorrules
Added a new rules file detailing R project and coding best practices (structure, packaging, naming, style, testing, reproducibility, Shiny guidance, tooling and dependencies).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • PatrickJS

Poem

I hop through files with curious nose,
Planting R rules where tidy code grows.
README echoes the new carrot twice,
Guiding projects to habits nice.
A rabbit's nudge for cleaner rows.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Adding Cursor Rules for the R programming language" accurately and concisely summarizes the primary change in the changeset—adding Cursor rules for R (a new .cursorrules file and corresponding README entries)—and is clear and specific enough for reviewers to understand the intent at a glance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0770ff and 36a3356.

📒 Files selected for processing (1)
  • rules/r-cursorrules-prompt-file-best-practices/.cursorrules (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rules/r-cursorrules-prompt-file-best-practices/.cursorrules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (9)
rules/r-cursorrules-prompt-file-best-practices/.cursorrules (9)

95-95: Remove or correct “in-memory data injection”.

“Injection” is not the right term here and duplicates the prior bullet about manipulation.

Apply one of:

- - 'data.table' or 'dplyr' for in-memory data injection. 
+ - (Remove this line; already covered by manipulation above)

or

- - 'data.table' or 'dplyr' for in-memory data injection. 
+ - 'readr' or 'data.table' for efficient data import (CSV/TSV, etc.).

7-7: Grammar: “Prefer Quarto if available.”

- - Use RMarkdown or Quarto for reports and documentation. Prefer Quarto is available and already installed.
+ - Use RMarkdown or Quarto for reports and documentation. Prefer Quarto if available and already installed.
- - Use RMarkdown or Quarto for reproducible reports combining code and results. Prefer 'Quarto' if already available and installed.
+ - Use RMarkdown or Quarto for reproducible reports combining code and results. Prefer Quarto if available and installed.

Also applies to: 61-61


12-12: Typo: “unncessary” → “unnecessary”.

- - Avoid using unncessary dependencies, if a task can be achieved relatively easily using base R, just use base R and import other packages only if necessary. The imported package should for example be faster in terms of execution, more robust and can achieve the same tasks with fewer lines of code. Otherwise, just use base R.
+ - Avoid using unnecessary dependencies. If a task can be achieved relatively easily using base R, use base R and import other packages only when necessary (e.g., measurably faster, more robust, or fewer lines of code).

4-4: Clarify ‘inst/’ usage (package-specific).

‘inst/’ is conventional for R packages; for non-package projects, consider ‘assets/’ or similar.

- - Organize projects into clear directories: 'R/' (scripts), 'data/' (raw and processed), 'output/' (results, plots), 'docs/' (reports, markdowns), 'inst/' for external files used within the project (.csv, .css and so on)
+ - Organize projects into clear directories: 'R/' (scripts), 'data/' (raw and processed), 'output/' (results, plots), 'docs/' (reports). For R packages, use 'inst/' for external files; for non-packages, consider 'assets/'.

21-21: Grammar: singular/plural and article.

- - If the R project is an R package, run 'devtools::check' to check if the packages has no issues. Notes are okay but warnings and errors should be avoided.
+ - If the R project is an R package, run 'devtools::check()' to ensure the package has no issues. Notes are okay; avoid warnings and errors.

37-37: Grammar tighten-up.

- - Use '#' for inline comments and section headers. Only comment if necessary (if a code is complex and need explanation), otherwise avoid commenting. The code should be self explanatory.
+ - Use '#' for inline comments and section headers. Comment only when necessary (e.g., complex code needing explanation). The code should be self‑explanatory.

41-41: Wording: “beforehands” → “beforehand”.

- - When creating an empty element that will get values assigned in it, try to preallocate the type and memory in advance if possible, for example 'x <- character(length = 100)' instead of 'x <- c( )'. 
+ - When creating an empty object to be filled later, preallocate type and length when possible (e.g., 'x <- character(length = 100)' instead of 'x <- c()').

46-48: Clarify “apply family” and pluralize loop.

- - Prefer vectorized functions and apply family ('lapply', 'sapply', 'purrr') over explicit loops. When using loop, try to preallocate type and memory beforehands.
+ - Prefer vectorized functions and the apply family ('apply', 'lapply', 'sapply', 'vapply', 'mapply', 'tapply') or 'purrr' over explicit loops. When using loops, preallocate type and memory beforehand.

14-14: Small consistency/grammar nits (optional).

  • Capitalize section heading consistently.
  • NAMESPACE/ Rd plural.
  • “package” → “packages”.
- ## Package structure
+ ## Package Structure
- - If the R project is an R package, make sure to always document the functions using 'roxygen' code. Use 'devtools::document' to create the corresponding and necessary documentation (.Rd files and NAMESPACE) file. 
+ - If the R project is an R package, document functions using roxygen2. Use 'devtools::document()' to generate the required documentation (.Rd files) and 'NAMESPACE' file.
- Have a preference for the following package when relying on a dependency:
+ Have a preference for the following packages when relying on dependencies:

Also applies to: 20-20, 91-91

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c78546c and f0770ff.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • rules/r-cursorrules-prompt-file-best-practices/.cursorrules (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.md

📄 CodeRabbit inference engine (.cursorrules)

Always use Markdown for documentation and README files

Files:

  • README.md
README.md

📄 CodeRabbit inference engine (.cursorrules)

README.md: Maintain the existing structure of the README.md file
Maintain the following structure in the README.md file: 1. Title and Awesome badge 2. Logo 3. Short description 4. "Why .cursorrules?" section 5. Table of Contents 6. Rules section (with subcategories) 7. How to Use section 8. Contributing section 9. License section
Maintain alphabetical order within each category in the README.md file
Use consistent formatting for list items in the README.md file
Update the README.md file when adding new .cursorrules files, placing them in the correct category
Ensure all links in the README.md file are relative and correct
When updating the README.md, ensure the table of contents remains accurate
When adding new categories, update both the 'Contents' and 'Rules' sections of the README.md

Files:

  • README.md
**/*.{md,cursorrules}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{md,cursorrules}: Use clear and concise language in all documentation and .cursorrules files
When adding examples or explanations, focus on practical use cases for Cursor AI users

Files:

  • README.md
🔇 Additional comments (1)
README.md (1)

236-236: LGTM: R rules entry added correctly (format, placement, link).

  • README.md has a single "R Best Practices" entry (line 236).
  • rules/r-cursorrules-prompt-file-best-practices/.cursorrules exists.

Copy link
Contributor Author

@feddelegrand7 feddelegrand7 left a comment

Choose a reason for hiding this comment

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

update cursor file

@PatrickJS PatrickJS merged commit bcb4542 into PatrickJS:main Sep 24, 2025
1 check passed
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