Skip to content

Add optional max parameter in icon_assign() #63

Description

@StefanMusch

Instead of always calculating the max from the values itself, it would be a great feature to allow the user to input the max value. E.g., I have a few tables where the score is out of 10, but for some cuts, the max value is 6, so it only shows 6 icons, whereas I'd like it to show 6 out of 10.

Any way this is already doable with the current functionality by making a row not visible?

Here's a quick and dirty addition:

Adding a parameter:

function(max = NULL){

 max_value <- max(floor(data[[name]] + 0.5)

  if (max < max_value, na.rm = TRUE)) {
    stop("`max` must be higher than your highest data value, which is {max_value}")
  }
}

     if(!is.null(max)){
        max_value <- max
      } else {
        max_value <- max(floor(data[[name]] + 0.5), na.rm = TRUE)
      }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions