Fx=purrr::map(CDF, ~ tibble(
severity=severities$severity,
inclusive=severities$inclusive,
Fx=.x(severities$severity, severities$inclusive))))
raw_df <- tibble::tribble(
~"segment", ~"limit", ~"attach", ~"pct_written", ~"premium", ~"product", ~"lalae_ratio",
"", 50000, 1000, 0.5, 273456, "prod1", 0.65,
"", 20000, 2000, 0.5, 285760, "prod2", 0.65,
"", 2e+05, 3000, 0.5, 956456, "prod3", 0.65,
"", 10000, 300, 0.5, 90890, "prod4", 0.65)
I can sort of guess it, but I do not have a precise definition of what it does.
This is different from:
dependent_variable ~ independent_variables
The tilde operator in R is a general operator that creates a formula object.
However, the usage in your specific pieces of code is a special case of that: purrr co-opts formulas to implement an anonymous function notation. You can read more in the purrr introduction. But briefly, the usage
purrr::map(data, ~ expression_with(.x))
Is equivalent to
purrr::map(data, function (.x) expression_with(.x))
The second piece of code does something different still, and that usage is described in the documentation of the tribble function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With