Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional max parameter in icon_assign() #63

Open
StefanMusch opened this issue Nov 30, 2023 · 0 comments
Open

Add optional max parameter in icon_assign() #63

StefanMusch opened this issue Nov 30, 2023 · 0 comments

Comments

@StefanMusch
Copy link

StefanMusch commented Nov 30, 2023

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)
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant