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

Question - conditionalFormatting for column with missing cell values #186

Closed
freddiebailey opened this issue May 2, 2021 · 2 comments
Closed

Comments

@freddiebailey
Copy link

freddiebailey commented May 2, 2021


Re-posting here as I saw @ycphs mention he was maintaining the active fork of the openxlsx package in awalker89/openxlsx#528


Expected Behavior

I have a table of data which I want to use the function conditionalFormatting() with, using "type = colour scale". For columns where the cells contain all non-missing values, the colourScale type works great. However, I have a number of columns where cells contain some NA values (which I do not want to remove). Whenever there is a column with NA my code doesn't work. It currently looks like this:

Expected


Actual Behavior

Conditionally format the columns containing missing cells using a colour scale argument in conditionalFormatting(). When I open up the spreadsheet I have created in Excel then I am able to conditionally format this manually, but I want this to be an automated process. It should look like this:

Actual


Steps to Reproduce the Problem

My code is:

conditionalFormatting(wb, new_sheet2, cols = 1, rows = 2:(nrow(My_Report) + 1), type = "colourScale", rule = c((min(My_Report[1])), (max(My_Report[1]))), style = c("pink", "red"))

conditionalFormatting(wb, new_sheet2, cols = 2, rows = 2:(nrow(My_Report) + 1), type = "colourScale", rule = c((min(My_Report[2])), (max(My_Report[2]))), style = c("pink", "red"))


sessionInfo()

  • Version of openxlsx: 4.2.3
  • Version of R: 4.0.4

@github-actions
Copy link

github-actions bot commented May 7, 2022

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 7, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

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

No branches or pull requests

2 participants