Questions tagged [stringi]

stringi is THE R package for fast, correct, consistent and convenient string/text processing in each locale and any native character encoding. The use of the ICU library gives R users a platform-independent set of functions known to Java, Perl, Python, PHP, and Ruby programmers.

's stringi package provides a platform independent way of manipulating strings. It is built on the library and has a syntax inspired by the package.

Repositories

Other resources

Related tags

237 questions
4
votes
3 answers

String replace with regex condition

I have a pattern that I want to match and replace with an X. However, I only want the pattern to be replaced if the preceding character is either an A, B or not preceeded by any character (beginning of string). I know how to replace patterns using…
Nivel
  • 429
  • 3
  • 9
4
votes
2 answers

Count unique string patterns in a row

i have a following example: dat <- read.table(text="index string 1 'I have first and second' 2 'I have first, first' 3 'I have second and first and thirdeen'", header=TRUE) toMatch <- c('first', 'second', 'third') dat$count <-…
LMach
  • 43
  • 3
4
votes
1 answer

Cannot install stringi since Xcode Command Line Tools update

System: macOS Sierra 10.12.6 Xcode: 9.2 (2347) R: 3.4.0 RStudio: 1.1.383 I'm attempting to install the latest version of stringi (1.1.6). This isn't possible since the most recent update to Xcode. The error received is configure: error: C…
Serenthia
  • 990
  • 1
  • 17
  • 36
4
votes
4 answers

stringi install error: configure: error: C compiler cannot create executables

I am trying to install stringi package after a recent update of R to newest version. However, I met this error: * installing *source* package ‘stringi’ ... ** package ‘stringi’ successfully unpacked and MD5 sums checked checking for local…
mt1022
  • 15,027
  • 4
  • 36
  • 59
4
votes
2 answers

How to use paste with for-loops?

I am trying to use the function stri_join, from the library stringi in a loop, but I am having difficulties. I would like to obtain "A_1.png", "A_2.png", "A_3.png", "A_4.png", "A_5.png", and so on until "A_200.png". Here is my attempt: x <-…
dede
  • 1,007
  • 3
  • 13
  • 28
4
votes
2 answers

Extract year from string and text data

I need extract start year and end year from a vector with values of these nature. yr<- c("June 2013 – Present (2 years 9 months)", "January 2012 – June 2013 (1 year 6 months)","2006 – Present (10 years)","2002 – 2006 (4 years)") yr June 2013 –…
user3570187
  • 1,525
  • 1
  • 15
  • 29
4
votes
2 answers

Extract words between doubles quotes in a variable in R

I want to extract the name from the following input which is of the form as shown in brackets # Example of the input in brackets('name":"Tale") name<- c('name":"Tale"','name":"List"') I want to extract the names between the quotes as shown below.…
user3570187
  • 1,525
  • 1
  • 15
  • 29
3
votes
2 answers

How to loop through mapply in R?

I am trying to concatenate strings using mapply function in R. However, I want one of the strings to be variable in mapply function. I have a snippet of my code…
user86907
  • 685
  • 1
  • 10
3
votes
3 answers

extract text from email and between two dots in R

I have some email address where I am trying to extract the domain from. I found a solution here but it is taking too long. I am trying with the following approach: First remove all the text before the @ sign. gsub("@(.+)$", "\\1", emails) Other -…
user8959427
  • 1,937
  • 6
  • 13
3
votes
5 answers

extracting the second last word between the special characters "/"

I would like to extract the second last string after the '/' symbol. For example, url<- c('https://example.com/names/ani/digitalcod-org','https://example.com/names/bmc/ambulancecod.org' ) df<- data.frame (url) I want to extract the second word…
user3570187
  • 1,525
  • 1
  • 15
  • 29
3
votes
2 answers

Add a white-space between number and special character condition R

I'm trying to use stringr or R base calls to conditionally add a white-space for instances in a large vector where there is a numeric value then a special character - in this case a $ sign without a space. str_pad doesn't appear to allow for a…
js80
  • 317
  • 2
  • 9
3
votes
1 answer

Appveyor problem - R package stringi can't be installed

Lately the build with Appveyor does not work any more. It fails before actually building the program, because somehow the package stringi can't be installed. Locally everything works fine, but I need a workaround for Appveyor. Has anybody a solution…
Steffen Moritz
  • 4,758
  • 11
  • 30
  • 46
3
votes
1 answer

R: split string vector by delimiter and rearrange

I have string vector that needs to be split and rearranged in a matrix in a certain way. I know how to do split/simple rearrange, but lost how my to rearrange how I want: library(stringi) vec = c("b;a;c","a;c","c;b") q = stri_split_fixed(vec, ";",…
Alexey Ferapontov
  • 4,529
  • 4
  • 18
  • 36
3
votes
4 answers

Fast way for String matching and replacement from another dataframe in R

I have two dataframes that look like this (although the first one is over 90 million rows long and the second dataframe is a little over 14 million rows) Also the second dataframe is randomly ordered df1 <- data.frame( datalist =…
Kayla
  • 117
  • 8
3
votes
1 answer

Rstudio how to get stringi package installation to work? All good until dyn.load simply fails

At wit's end after updating to latest: my Ubuntu 16.04LTS update/upgrades, my R version, my Rstudio-server version, my libicu-dev version, verified that anaconda is providing my python but not my R language. What else can help? This stringi…
Geoffrey Anderson
  • 1,293
  • 10
  • 18
1 2
3
15 16