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

warning message from dataValidation with type="list" #546

Open
namarkus opened this issue Feb 4, 2023 · 0 comments
Open

warning message from dataValidation with type="list" #546

namarkus opened this issue Feb 4, 2023 · 0 comments

Comments

@namarkus
Copy link

namarkus commented Feb 4, 2023

Hi there,

it's just a minor issue, but it is annoying, because it generates constantly warning messages while building excel-files that contain dataValidation

reproducible example

using the example from the dataValidation help page:

wb <- createWorkbook()
addWorksheet(wb, "Sheet 1")
addWorksheet(wb, "Sheet 2")

writeDataTable(wb, sheet = 1, x = iris[1:30, ])
writeData(wb, sheet = 2, x = sample(iris$Sepal.Length, 10))

dataValidation(wb, 1, col = 1, rows = 2:31, type = "list", value = "'Sheet 2'!$A$1:$A$10")

step dataValidation generates warning message:

Warning message:
In sprintf("<x14:dataValidation type="list" allowBlank="%s" showInputMessage="%s" showErrorMessage="%s">", :
one argument not used by format '<x14:dataValidation type="list" allowBlank="%s" showInputMessage="%s" showErrorMessage="%s">'

solution

The origin of this issue is found in function wb$dataValidation_list()
in line:

data_val <- sprintf("<x14:dataValidation type=\"list\" allowBlank=\"%s\" showInputMessage=\"%s\" showErrorMessage=\"%s\">", 
                    allowBlank, showInputMsg, showErrorMsg, sqref)

the "sqref" value is superfluous. The string in fmt-argument expects only 3 values.

sessionInfo()

  • Version of openxlsx: 4.2.5.1 (most recent)
  • Version of R: 4.2.2
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