list.of.packages <- c('stringr', 'stringi')
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
## loading the necessary packages: stringr, stringi
invisible(lapply(list('stringr', 'stringi'), require, character.only = TRUE))
## Loading required package: stringr
## Loading required package: stringi
packageVersion("stringi")
## [1] '1.5.3'
packageVersion("stringr")
## [1] '1.4.0'
ls("package:stringi")
## [1] "%s!=%" "%s!==%"
## [3] "%s$%" "%s*%"
## [5] "%s+%" "%s<%"
## [7] "%s<=%" "%s==%"
## [9] "%s===%" "%s>%"
## [11] "%s>=%" "%stri!=%"
## [13] "%stri!==%" "%stri$%"
## [15] "%stri*%" "%stri+%"
## [17] "%stri<%" "%stri<=%"
## [19] "%stri==%" "%stri===%"
## [21] "%stri>%" "%stri>=%"
## [23] "stri_c" "stri_c_list"
## [25] "stri_cmp" "stri_cmp_eq"
## [27] "stri_cmp_equiv" "stri_cmp_ge"
## [29] "stri_cmp_gt" "stri_cmp_le"
## [31] "stri_cmp_lt" "stri_cmp_neq"
## [33] "stri_cmp_nequiv" "stri_coll"
## [35] "stri_compare" "stri_conv"
## [37] "stri_count" "stri_count_boundaries"
## [39] "stri_count_charclass" "stri_count_coll"
## [41] "stri_count_fixed" "stri_count_regex"
## [43] "stri_count_words" "stri_datetime_add"
## [45] "stri_datetime_add<-" "stri_datetime_create"
## [47] "stri_datetime_fields" "stri_datetime_format"
## [49] "stri_datetime_fstr" "stri_datetime_now"
## [51] "stri_datetime_parse" "stri_datetime_symbols"
## [53] "stri_detect" "stri_detect_charclass"
## [55] "stri_detect_coll" "stri_detect_fixed"
## [57] "stri_detect_regex" "stri_dup"
## [59] "stri_duplicated" "stri_duplicated_any"
## [61] "stri_enc_detect" "stri_enc_detect2"
## [63] "stri_enc_fromutf32" "stri_enc_get"
## [65] "stri_enc_info" "stri_enc_isascii"
## [67] "stri_enc_isutf16be" "stri_enc_isutf16le"
## [69] "stri_enc_isutf32be" "stri_enc_isutf32le"
## [71] "stri_enc_isutf8" "stri_enc_list"
## [73] "stri_enc_mark" "stri_enc_set"
## [75] "stri_enc_toascii" "stri_enc_tonative"
## [77] "stri_enc_toutf32" "stri_enc_toutf8"
## [79] "stri_encode" "stri_endswith"
## [81] "stri_endswith_charclass" "stri_endswith_coll"
## [83] "stri_endswith_fixed" "stri_escape_unicode"
## [85] "stri_extract" "stri_extract_all"
## [87] "stri_extract_all_boundaries" "stri_extract_all_charclass"
## [89] "stri_extract_all_coll" "stri_extract_all_fixed"
## [91] "stri_extract_all_regex" "stri_extract_all_words"
## [93] "stri_extract_first" "stri_extract_first_boundaries"
## [95] "stri_extract_first_charclass" "stri_extract_first_coll"
## [97] "stri_extract_first_fixed" "stri_extract_first_regex"
## [99] "stri_extract_first_words" "stri_extract_last"
## [101] "stri_extract_last_boundaries" "stri_extract_last_charclass"
## [103] "stri_extract_last_coll" "stri_extract_last_fixed"
## [105] "stri_extract_last_regex" "stri_extract_last_words"
## [107] "stri_flatten" "stri_info"
## [109] "stri_isempty" "stri_join"
## [111] "stri_join_list" "stri_length"
## [113] "stri_list2matrix" "stri_locale_get"
## [115] "stri_locale_info" "stri_locale_list"
## [117] "stri_locale_set" "stri_locate"
## [119] "stri_locate_all" "stri_locate_all_boundaries"
## [121] "stri_locate_all_charclass" "stri_locate_all_coll"
## [123] "stri_locate_all_fixed" "stri_locate_all_regex"
## [125] "stri_locate_all_words" "stri_locate_first"
## [127] "stri_locate_first_boundaries" "stri_locate_first_charclass"
## [129] "stri_locate_first_coll" "stri_locate_first_fixed"
## [131] "stri_locate_first_regex" "stri_locate_first_words"
## [133] "stri_locate_last" "stri_locate_last_boundaries"
## [135] "stri_locate_last_charclass" "stri_locate_last_coll"
## [137] "stri_locate_last_fixed" "stri_locate_last_regex"
## [139] "stri_locate_last_words" "stri_match"
## [141] "stri_match_all" "stri_match_all_regex"
## [143] "stri_match_first" "stri_match_first_regex"
## [145] "stri_match_last" "stri_match_last_regex"
## [147] "stri_na2empty" "stri_numbytes"
## [149] "stri_omit_empty" "stri_omit_empty_na"
## [151] "stri_omit_na" "stri_opts_brkiter"
## [153] "stri_opts_collator" "stri_opts_fixed"
## [155] "stri_opts_regex" "stri_order"
## [157] "stri_pad" "stri_pad_both"
## [159] "stri_pad_left" "stri_pad_right"
## [161] "stri_paste" "stri_paste_list"
## [163] "stri_rand_lipsum" "stri_rand_shuffle"
## [165] "stri_rand_strings" "stri_read_lines"
## [167] "stri_read_raw" "stri_remove_empty"
## [169] "stri_remove_empty_na" "stri_remove_na"
## [171] "stri_replace" "stri_replace_all"
## [173] "stri_replace_all_charclass" "stri_replace_all_coll"
## [175] "stri_replace_all_fixed" "stri_replace_all_regex"
## [177] "stri_replace_first" "stri_replace_first_charclass"
## [179] "stri_replace_first_coll" "stri_replace_first_fixed"
## [181] "stri_replace_first_regex" "stri_replace_last"
## [183] "stri_replace_last_charclass" "stri_replace_last_coll"
## [185] "stri_replace_last_fixed" "stri_replace_last_regex"
## [187] "stri_replace_na" "stri_reverse"
## [189] "stri_sort" "stri_sort_key"
## [191] "stri_split" "stri_split_boundaries"
## [193] "stri_split_charclass" "stri_split_coll"
## [195] "stri_split_fixed" "stri_split_lines"
## [197] "stri_split_lines1" "stri_split_regex"
## [199] "stri_startswith" "stri_startswith_charclass"
## [201] "stri_startswith_coll" "stri_startswith_fixed"
## [203] "stri_stats_general" "stri_stats_latex"
## [205] "stri_sub" "stri_sub_all"
## [207] "stri_sub_all_replace" "stri_sub_all<-"
## [209] "stri_sub_replace" "stri_sub_replace_all"
## [211] "stri_sub<-" "stri_subset"
## [213] "stri_subset_charclass" "stri_subset_charclass<-"
## [215] "stri_subset_coll" "stri_subset_coll<-"
## [217] "stri_subset_fixed" "stri_subset_fixed<-"
## [219] "stri_subset_regex" "stri_subset_regex<-"
## [221] "stri_subset<-" "stri_timezone_get"
## [223] "stri_timezone_info" "stri_timezone_list"
## [225] "stri_timezone_set" "stri_trans_char"
## [227] "stri_trans_general" "stri_trans_isnfc"
## [229] "stri_trans_isnfd" "stri_trans_isnfkc"
## [231] "stri_trans_isnfkc_casefold" "stri_trans_isnfkd"
## [233] "stri_trans_list" "stri_trans_nfc"
## [235] "stri_trans_nfd" "stri_trans_nfkc"
## [237] "stri_trans_nfkc_casefold" "stri_trans_nfkd"
## [239] "stri_trans_tolower" "stri_trans_totitle"
## [241] "stri_trans_toupper" "stri_trim"
## [243] "stri_trim_both" "stri_trim_left"
## [245] "stri_trim_right" "stri_unescape_unicode"
## [247] "stri_unique" "stri_width"
## [249] "stri_wrap" "stri_write_lines"
ls("package:stringr")
## [1] "%>%" "boundary" "coll" "fixed"
## [5] "fruit" "invert_match" "regex" "sentences"
## [9] "str_c" "str_conv" "str_count" "str_detect"
## [13] "str_dup" "str_ends" "str_extract" "str_extract_all"
## [17] "str_flatten" "str_glue" "str_glue_data" "str_interp"
## [21] "str_length" "str_locate" "str_locate_all" "str_match"
## [25] "str_match_all" "str_order" "str_pad" "str_remove"
## [29] "str_remove_all" "str_replace" "str_replace_all" "str_replace_na"
## [33] "str_sort" "str_split" "str_split_fixed" "str_squish"
## [37] "str_starts" "str_sub" "str_sub<-" "str_subset"
## [41] "str_to_lower" "str_to_sentence" "str_to_title" "str_to_upper"
## [45] "str_trim" "str_trunc" "str_view" "str_view_all"
## [49] "str_which" "str_wrap" "word" "words"
These were the comments from Hadley Wickham
stringi provides tools to do anything we could ever want to do with strings, where stringr provides tools to do the most common 95% of operations. This allows stringr to be much simpler, and the cost of some flexibility.stringi is implemented in C using the ICU string library, so it's very fast and very correct (it deals with unicode better than base R).stringr and stringi have very similar interfaces, so we should be able to move up from stringr to stringi very easily. The next version of stringr will use stringi, so stringr will get all the performance benefits (and bug fixes!), and we can continue to use the simple interface.