Skip to content

Add .format argument to prj_project() #31

@kinto-b

Description

@kinto-b

@paddytobias You can turn off rounding by setting digits=NULL. Try

prj_project(
  dat, list(
    `V-Shaped` = c(p = "{srcreporting::dec_dig3(p, 2)} ({n})"),
    `Not V-shaped` = c(p = "{srcreporting::dec_dig3(p, 2)} ({n})")
  ), .digits = NULL
)

I added rounding as a default because I found myself writing "{round(p, 2)}" literally every time I did a projection. On net I think it saves more typing having the default this way rather than having .digits=NULL by default.

One thing that would be neat though is to deprecate the .digits argument and replace with a .format argument which accepts a formatting function (i.e. a one place function that accepts a string and returns a string). By default .format = round_transformer but then you could write .format = srcreporting::dec_dig3

Originally posted by @kinto-b in #30 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions