JanMarvin / openxlsx2

openxlsx2 - read, write and modify xlsx files
https://janmarvin.github.io/openxlsx2/
Other
117 stars 9 forks source link

[dims] unexpected result with non continuous rows and x #1124

Closed JanMarvin closed 1 month ago

JanMarvin commented 1 month ago
library(openxlsx2)

# equal with sample cols
wb_dims(x = mtcars, cols = c(1, 4:7, 9))
#> [1] "A2:A33,D2:D33,E2:E33,F2:F33,G2:G33,I2:I33"
wb_dims(rows = seq_len(nrow(mtcars)) + 1L, cols = c(1, 4:7, 9))
#> [1] "A2:A33,D2:D33,E2:E33,F2:F33,G2:G33,I2:I33"

# unequeal with sample rows
wb_dims(x = mtcars, rows = which(mtcars$cyl == 6))
#> [1] "A2:K8"
wb_dims(rows = which(mtcars$cyl == 6) + 1L, cols = seq_along(mtcars))
#> [1] "A2:K2,A3:K3,A5:K5,A7:K7,A11:K11,A12:K12,A31:K31"