[R] openxlsx Error: length of rows and cols must be

G.Maubach at weinwolf.de G.Maubach at weinwolf.de
Tue Nov 15 13:48:50 CET 2016


Hi All,

when using 

-- cut --

    number_style <- openxlsx::createStyle(
      numFmt = "COMMA"
    )

    openxlsx::addStyle(
      wb = xlsx_workbook,
      sheet = "Kundenliste",
      style = number_style,
      rows = 2:nrow(customer_list),
      cols = 4:5
      )
--cut --

I get the error

Error in openxlsx::addStyle(wb = xlsx_workbook, sheet = "Kundenliste",  : 
  Length of rows and cols must be equal.

The customer_list can be of any arbritrary length due to subgroup 
definitons. I do not see why the argument "rows" and "cols" should be of 
the same length. This would mean that number formatting can only be done 
for rectangular areas.

What do I need to change to format my numbers in the given area correctly?

Kind regards

Georg



More information about the R-help mailing list