Skip to content

Feature: Function to create functional sequences #254

Open
@mikmart

Description

@mikmart

Inspired by this StackOverflow question, I was wondering if it might be useful to have a function to create functional sequences? AFAIK, the only way to create a fseq is to start a pipe sequence with .:

library(magrittr)

. %>%
  mean() %>% 
  format(nsmall = 3)
#> Functional sequence with the following components:
#> 
#>  1. mean(.)
#>  2. format(., nsmall = 3)
#> 
#> Use 'functions' to extract the individual functions.

For defining each step in the sequence programmatically, it might be nice to have other interfaces. Perhaps something like this to create the above?

functional_sequence(
  mean(),
  format(nsmall = 3)
)

steps <- expression(
  mean(),
  format(nsmall = 3)
)

as_functional_sequence(step)

I haven’t thought about how to actually implement these, but I was wondering if this might be something that could potentially be added to magrittr?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions