ksformat Usage Examples12 days ago
Example 1: Basic Discrete Formatting | Example 2: Numeric Range Formatting | Example 3: Decimal Ranges (BMI Categories) | Example 4: Exclusive/Inclusive Bounds | Example 5: Reverse Formatting with Invalue | Example 6: Bidirectional Formatting | Example 7: Parse Multiple Formats from Text | Example 8: Export Formats Back to Text | Example 9: SAS-like PUT/INPUT Functions | Example 10: Data Frame Formatting | Example 11: Missing Value Handling | Example 12: Date/Time Formats (SAS-style) | SAS Date Formats | R Numeric Dates (Days Since 1970-01-01) | Time Formats | Datetime Formats | Custom Date Formats with fnew_date() | Date Formats in Data Frames | Parse Date Formats from Text | Example 13: Multilabel Formats | Overlapping Age Categories | Multilabel with Missing Values | Parse Multilabel from Text | Multilabel Export | Practical Example: Adverse Event Severity Grading | Example 14: Case-Insensitive Matching | Example 15: Expression Labels in Formats | Simple sprintf Expression | Two Extra Arguments (.x1, .x2) | ifelse Expression | Mixed Static and Expression Labels | Expression in .other Fallback | Scalar Recycling | Statistical Table Format with Computed Labels | Example 16: Vectorized Format Names (SAS PUTC-style) | Example 17: Working with Dates and Formats — PUTN | Example 18: Import SAS Formats from CNTLOUT CSV | Use Imported Formats | Apply to Data Frame | Export Imported Format | Selective Import (No Auto-register) | Example 19: Bilingual Format | Example 20: Composite Key Lookup with fputk() | Character lookup (returns character strings) | Native Date lookup (returns Date objects) | Example 21: Consistent Data-Driven Formats with fmap() | Clinical-data example | Same fmap(keys, values) pattern for both types | When to use the default (reversal on) | Summary | Example 22: Date Lookup via fparse() and fputk() | Character date lookup | Native Date lookup | Round-trip: export and re-import | Example 23: Inspecting Range Rules with franges() | Completing a Summary Against Format Labels | Getting Unique Labels from a Format | Example 24: Reverse Range Lookup with fmap_to_ranges() | Example 25: Date Range Bucketing | Fiscal-year bucketing | Define from text with fparse() | LOW / HIGH open-ended bounds | Export and roundtrip | Overlapping buckets with multilabel and fput_all() | Auto-detection of type | Datetime range bucketing | Example 26: Stratified Range Lookup with fputk() | Programmatic construction with fmap_strata() | Text definition with fparse() | Date subtype: per-subject windows | Roundtrip via fexport() / fparse() | Example 27: Plain Range Lookup with fmap_ranges() | Example 28: Composite Key Lookup with NA Components (na_as_string) | Clinical example — LB parameter derivation | The rule of thumb | Example 29: Composite Label Invalue Lookup with finputk() | Basic usage | With NA components (na_as_string = TRUE) | Example 30: Extract Discrete Levels with flevels() | Example 31: Numeric Pattern Formatting | Example 32: Bidirectional nocase for Character Types