You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically I want to be able to pass something analog to which(..., arr.ind = TRUE). This should be possible with rowcol_to_dims(enforce = TRUE) and/or with wb_dims(enforce = TRUE). The argument enforce is already used in wb_add_data() to indicate that specific dims are requested.
library(openxlsx2)
# create a subset of mtcarsdf<-mtcars[14:19, ]
# create coordinates from the which condition df < 4df_sel<- as.data.frame(which(df<4, arr.ind=TRUE))
# helper function to create dims out of the conditionrowcol_to_dims2<-function(row, col) {
if (length(row) != length(col)) stop("lengths are unequal")
cols<- int2col(col)
rows<- as.integer(row)
cells<- vapply(seq_along(row), function(x) paste0(cols[x], rows[x]), NA_character_)
paste0(cells, collapse=",")
}
# create the dimssel_dims<- rowcol_to_dims2(row=df_sel$row, col=df_sel$col)
dims_to_dataframe(dims=sel_dims, fill=TRUE)
#> E F G H I J K#> 1 E1 F1 H1 I1 J1 K1#> 2 E2 H2 I2 J2 #> 3 E3 H3 I3 J3 #> 4 E4 H4 I4 J4 #> 5 F5 H5 I5 K5#> 6 F6 H6 I6 K6# use thiswb<- wb_workbook()$add_worksheet()$add_data(x=df, col_names=FALSE)$
add_fill(dims=sel_dims, color= wb_color("yellow"))
if(interactive()) wb$open()
The text was updated successfully, but these errors were encountered:
Basically I want to be able to pass something analog to
which(..., arr.ind = TRUE)
. This should be possible withrowcol_to_dims(enforce = TRUE)
and/or withwb_dims(enforce = TRUE)
. The argumentenforce
is already used inwb_add_data()
to indicate that specific dims are requested.The text was updated successfully, but these errors were encountered: