types-check

Validate R function inputs using standalone check_* utilities.

658|110|Updated Dec 10, 2017
One-click install
npx skills add https://github.com/tidymodels/parsnip --skill types-check-tidymodels
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: types-check
Source: https://github.com/tidymodels/parsnip/tree/main/.claude/skills/tidy-argument-checking
Command: npx skills add https://github.com/tidymodels/parsnip --skill types-check-tidymodels

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Validate function inputs in R using a standalone file of check_* functions. Use when writing exported R functions that need input validation, reviewing existing validation code, or when creating new input validation helpers.

Core Features & Use Cases

  • Scalars (single values) with check_string, check_name, check_number_whole, check_number_decimal, and check_bool to enforce argument types.
  • Vectors and data structures with check_character, check_data_frame, and related validators to ensure proper shapes and content.
  • Optional/null handling with allow_null and advice on validating at function entry points to promote robust, predictable code.
  • Use cases include building reliable package APIs, validating user inputs in exported functions, and documenting clear error messages for failed validations.

Quick Start

Add an entry-point input validation using check_* helpers (e.g., check_string, check_number_whole) at the start of your function to enforce valid arguments.

Frequently Asked Questions about types-check

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate function inputs in an R package to produce clear error messages?

You can validate function inputs in R by adding check_* helpers like check_string or check_number_whole at the start of your exported functions. This enforces valid arguments and generates clear, actionable error messages for users.

What is the best way to check scalar types in R exported functions?

To check scalar types in R, use check_string, check_name, check_number_whole, check_number_decimal, and check_bool helpers. These validators enforce argument types at function entry points to ensure predictable code behavior.

How do I handle null or optional arguments when validating R function inputs?

When validating R function inputs, you can handle optional or null arguments by applying the allow_null parameter within your check_* helpers. This accommodates optional values while still enforcing type constraints when arguments are provided.

Can I validate data frames and vectors in R using standalone check functions?

Yes, you can validate data frames and vectors in R using standalone check_character, check_data_frame, and related validators. These helpers ensure your data structures maintain the proper shapes and content required by your functions.

What types of input validation checks does the tidymodels approach support for R package development?

The tidymodels approach to input validation in R package development supports rlang-style checkers for scalars, vectors, and data structures. It helps build reliable package APIs by enforcing type and value constraints with documented error messages.

When should I use standalone check_* utilities instead of base R assertions for package development?

You should use standalone check_* utilities when writing exported R functions that need input validation with clear, actionable error messages. They are designed to review existing validation code and create robust input validation helpers in package development workflows.