Displaying 7 results from an estimated 7 matches for "stri_sub".
Did you mean:
str_sub
2020 Jun 27
1
Error in substring: invalid multibyte string
...as more concerned with the inconsistency in results between
substr and regexpr. I was expecting that if one of them errors because of
an unknown encoding then the other should as well. Even better, if regexpr
works, why shouldn't substr work as well?
Incidentally the analogous stringi function stri_sub works fine in this
case:
> stringi::stri_sub("<I>Jens Oehlschl\xe4gel-Akiyoshi", 1, 100)
[1] "<I>Jens Oehlschl\xe4gel-Akiyoshi"
But the stringi analog to nchar gives a similar warning:
> stringi::stri_length("<I>Jens Oehlschl\xe4gel-Akiyoshi"...
2019 Feb 22
1
Bug: time complexity of substring is quadratic as string size and number of substrings increases
On 2/20/19 7:55 PM, Toby Hocking wrote:
> Update: I have observed that stringi::stri_sub is linear time complexity,
> and it computes the same thing as base::substring. figure
> https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.png
> source:
> https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.R
>
> To me this...
2019 Feb 20
2
Bug: time complexity of substring is quadratic as string size and number of substrings increases
Hi all, (and especially hi to Tomas Kalibera who accepted my patch sent
yesterday)
I believe that I have found another bug, this time in the substring
function. The use case that I am concerned with is when there is a single
(character scalar) text/subject, and many substrings to extract. For example
substring("AAAA", 1:4, 1:4)
or more generally,
N=1000
2019 Feb 20
0
Bug: time complexity of substring is quadratic as string size and number of substrings increases
Update: I have observed that stringi::stri_sub is linear time complexity,
and it computes the same thing as base::substring. figure
https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.png
source:
https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.R
To me this is a clear indication of a b...
2020 Jun 26
2
Error in substring: invalid multibyte string
Hi all,
I'm getting the following error from substring:
> substr("<I>Jens Oehlschl\xe4gel-Akiyoshi", 1, 100)
Error in substr("<I>Jens Oehlschl\xe4gel-Akiyoshi", 1, 100) :
invalid multibyte string at '<e4>gel-A<6b>iyoshi'
Is that normal / intended? I've tried setting the Encoding/locale to
Latin-1/UTF-8 but that does not help. nchar
2023 Jan 27
0
Resumen de R-help-es, Vol 167, Envío 10
...> 6 0 0 1 0
> 7 1 0 0 0
> 8 1 1 1 0
> 9 0 0 0 0
> 10 0 1 1 1
> > > #--- Función compara parejas de columnas comienzan por mismas 2 letras.
> > *colcompare <- function(df)* {
> +
> + nam_val <- names(df) %>% stri_sub(from = 1, to = 2) %>% unique()
> + res_df <- data.table()
> + for (i in 1:length(nam_val)) {
> + cols_tmp <- nam_val[i]
> + df_tmp <- df %>% select.(starts_with(cols_tmp)) %>%
> + rename.( a = 1) %>%
> + rename.( b = 2) %>%
&g...
2023 Jan 28
0
Resumen de R-help-es, Vol 167, Envío 10
...> 6 0 0 1 0
> 7 1 0 0 0
> 8 1 1 1 0
> 9 0 0 0 0
> 10 0 1 1 1
> > > #--- Función compara parejas de columnas comienzan por mismas 2 letras.
> > *colcompare <- function(df)* {
> +
> + nam_val <- names(df) %>% stri_sub(from = 1, to = 2) %>% unique()
> + res_df <- data.table()
> + for (i in 1:length(nam_val)) {
> + cols_tmp <- nam_val[i]
> + df_tmp <- df %>% select.(starts_with(cols_tmp)) %>%
> + rename.( a = 1) %>%
> + rename.( b = 2) %>%
&g...