[R] openxlsx Error: length of rows and cols must be
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Tue Nov 15 14:45:13 CET 2016
This behavior is a basic limitation of spreadsheets. This R API is (inappropriately) more flexible than the underlying Java API is. You have to apply your formatting with multiple calls to the addStyle function, just as you would interactively in a spreadsheet.
--
Sent from my phone. Please excuse my brevity.
On November 15, 2016 4:48:50 AM PST, G.Maubach at weinwolf.de wrote:
>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
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list