NEWS


stringmagic 1.2.0

Compatibility with old R versions

Bugs

New operators

dna = string_split("atagggagctacctgcgcgtcgcccaaaagcaggg", "")
cat_magic("Letters in the DNA seq. {''c, Q? dna}: ",
          # by default: inverse frequency sorting
          "  -      default: {table, enum ? dna}",
          "  - value sorted: {table.sort, enum ? dna}",
          # argument in single quotes to customize the display, it's a 
          #   `string_magic` interpolation
          "  -       shares: {'{x} [{round(s * 100)}%]' table, enum ? dna}",
          # `fsort` sorts by **increasing** frequency
          "  - freq. sorted: {'{q ? x}' table.fsort, enum ? dna}",
          .sep = "\n")
#> Letters in the DNA seq. "atagggagctacctgcgcgtcgcccaaaagcaggg": 
#>   -      default: g (12), c (10), a (9) and t (4)
#>   - value sorted: a (9), c (10), g (12) and t (4)
#>   -       shares: g [34%], c [29%], a [26%] and t [11%]
#>   - freq. sorted: 't', 'a', 'c' and 'g'

New features

User visible change: Functions renaming

Minor changes

stringmagic 1.1.2 (2024-04-30)

Hot fix

New features

stringmagic 1.1.1 (2024-04-25)

Hot fix

stringmagic 1.1.0 (2024-03-06)

New functions

Improvements

x = "Hi Mary, how's John doing?"
from = "John"
to = "Kate"
string_clean(x, "m/{from} => {to}")
#> [1] "Hi Mary, how's Kate doing?"
data = list(x = c(15, 25, 550), y = rnorm(1000))
string_magic("The values are{& length(data$x) < 5 ; : {enum ? .} ;  too many}.")
# [1] "The values are: 15, 25 and 550."
string_magic("The values are{& length(data$y) < 5 ; : {enum ? .} ;  too many}.")
# [1] "The values are too many."

Aliases

stringmagic 1.0.0 (2023-08-28)

First public release. The syntax should be stable.

This package is a spinoff from fixest's formula syntax interpolation.

Many thanks to Achim Zeileis, Vincent Arel-Bundock and Kyle Butts who provided insightful comments during the development.