Skip to content

Commit 173785c

Browse files
committed
[misc] use stringi in inner_update() this is fractions of a ms faster
1 parent 9df565f commit 173785c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ importFrom(grDevices,tiff)
164164
importFrom(magrittr,"%>%")
165165
importFrom(stringi,stri_c)
166166
importFrom(stringi,stri_encode)
167+
importFrom(stringi,stri_extract_first)
167168
importFrom(stringi,stri_isempty)
168169
importFrom(stringi,stri_join)
169170
importFrom(stringi,stri_match)

R/openxlsx2-package.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#' @import R6
1313
#' @importFrom grDevices bmp col2rgb colors dev.copy dev.list dev.off jpeg png rgb tiff
1414
#' @importFrom magrittr %>%
15-
#' @importFrom stringi stri_c stri_encode stri_isempty stri_join stri_match
16-
#' stri_match_all_regex stri_order stri_opts_collator stri_pad_left
17-
#' stri_rand_strings stri_read_lines stri_replace_all_fixed
15+
#' @importFrom stringi stri_c stri_encode stri_extract_first stri_isempty
16+
#' stri_join stri_match stri_match_all_regex stri_order stri_opts_collator
17+
#' stri_pad_left stri_rand_strings stri_read_lines stri_replace_all_fixed
1818
#' stri_split_fixed stri_split_regex stri_sub stri_unescape_unicode
1919
#' stri_unique
2020
#' @importFrom utils download.file head menu read.csv unzip

R/write.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ inner_update <- function(
6262
# create missing cells
6363
cc_missing <- create_char_dataframe(names(cc), length(missing_cells))
6464
cc_missing$r <- missing_cells
65-
cc_missing$row_r <- gsub("[[:upper:]]", "", cc_missing$r)
66-
cc_missing$c_r <- gsub("[[:digit:]]", "", cc_missing$r)
65+
cc_missing$row_r <- stringi::stri_extract_first(missing_cells, regex = "[0-9]+")
66+
cc_missing$c_r <- stringi::stri_extract_first(missing_cells, regex = "[A-Z]+")
6767

6868
# assign to cc
6969
cc <- rbind(cc, cc_missing)

0 commit comments

Comments
 (0)