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

Including proportion_bar into formatter #109

Open
TBaill opened this issue Sep 15, 2018 · 0 comments
Open

Including proportion_bar into formatter #109

TBaill opened this issue Sep 15, 2018 · 0 comments

Comments

@TBaill
Copy link

TBaill commented Sep 15, 2018

Hi there,

I am using formatter function into the formattable package and it works great.
But I'd like to use proportion_bar into formatter for a same variable but it doesn't work.

Here is my code :

formattable(eval, list( 
  area(col = c(Trimestre1, Trimestre2, Trimestre3, Trimestre4)) ~ proportion_bar(c("lightblue"), 0.2),
  Moyenne = proportion_bar(c("lightblue"),0.2),
  Moyenne = formatter("span",
                  style = x ~ style(color = ifelse(rank(-x) <= 3, "green", "gray")),
                  x ~ sprintf("%.2f (rang: %3.f)", x, round(rank(-x),1))
                         )
                      )
                  )

The result :
image

But I would like to apply the proportion_bar to my last variable Moyenne to see the proportion AND to have sprintf("%.2f (rang: %3.f)" as the value for my column.

Any ideas ?

Thanks a lot !

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