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

[experimental] standardize function arguments #678

Merged
merged 23 commits into from
Jul 10, 2023
Merged

[experimental] standardize function arguments #678

merged 23 commits into from
Jul 10, 2023

Conversation

JanMarvin
Copy link
Owner

@JanMarvin JanMarvin commented Jul 6, 2023

library(openxlsx2)

xlsxFile <- system.file("extdata", "openxlsx2_example.xlsx", package = "openxlsx2")
wb1 <- wb_load(xlsxFile)

# camelCase from the example
wb_to_df(wb1, sheet = 2, dims = "C6:G9", rowNames = TRUE)
#>                mpg cyl disp  hp
#> Mazda RX4     21.0   6  160 110
#> Mazda RX4 Wag 21.0   6  160 110
#> Datsun 710    22.8   4  108  93

# snake_case
wb_to_df(wb1, sheet = 2, dims = "C6:G9", row_names = TRUE)
#>                mpg cyl disp  hp
#> Mazda RX4     21.0   6  160 110
#> Mazda RX4 Wag 21.0   6  160 110
#> Datsun 710    22.8   4  108  93

I have squashed in many changes. Most functions should accept snake_case and camelCase arguments.

ToDo in follow up commits

  • Examples still need updates
  • Check for unused arguments
  • See how much code is broken
  • Further updates for NEWs
  • I've marked this experimental. If it breaks to much, it will have to be reverted

@olivroy
Copy link
Collaborator

olivroy commented Jul 7, 2023

Hi @JanMarvin, as I mentioned in the related issue (#38 (comment)), I think it would be good to phase out xlsxFile (xlsx_file) for just file for consistency throughout!

Edit: for clarity, the error message when file is not xlsx,
Error in f()
x file must be an xlsx file.

* wb_add_chart_xml
* wb_add_drawing
* wb_add_mschart
* wb_add_image
* wb_add_plot

deprecate start_col/start_row make dims the first arg after sheet
@JanMarvin JanMarvin changed the title [draft] add standardize_case-names() [WIP] add standardize_case-names() Jul 7, 2023
* wb_add_comment
* wb_remove_comment

deprecate col, row, gridExpand
* wb_add_chartsheet
* wb_add_data_validation
* create_dxfs_style
* wb_add_data_table
* wb_add_formula

Reodering arguments so that `x` is after `dims` sadly caused to much fallout in our own tests
* write_data
* write_data_table
* write_formula
* create_cell_style
* create_tablestyle
@JanMarvin JanMarvin changed the title [WIP] add standardize_case-names() [experimental] standardize function arguments Jul 10, 2023
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

Successfully merging this pull request may close these issues.

2 participants