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

298 questions
-1
votes
1 answer

Is stringi still a dependency for tidyverse

When I install package tidyverse from CRAN it takes forever (8mins 20 secs to be fair) to load package dependency stringi. This problem seems to be well documented. But if I am reading this tidyverse github issue correctly it looks like this stringi…
moreQthanA
  • 43
  • 9
-1
votes
1 answer

Split numbers and dates into separate columns

My data contains text strings with three important features, an id number separated by":" and a starting date and an end date. I need to get these tree numbers into three separate columns. I have tried different solutions, everything from…
Dr. Flow
  • 456
  • 5
  • 19
-1
votes
1 answer

Normalize ASCII to UTF-8 in R

I have a dataframe I am trying to convert to rdf to edit in Protege. The dataframe unfortunately has ASCII codes that are not visible when the strings are printed, most notoriously \u0020, which its he code for a space. x <- "\u0020". x > "…
MeeraWhy
  • 93
  • 6
-1
votes
1 answer

Find and replacing strings using stringr

I am trying to find and replace some of the values of a data frame consisting of strings. The simple case like the following works, library(stringr) test1 <- c("one", "two", "three") str_replace_all(string = test1, pattern = c('one'…
small_lebowski
  • 701
  • 7
  • 23
-1
votes
2 answers

Ordering telephone numbers

I have a dataset like below and the telephone numbers are in different digits and formats. Would you help me ordering them into a standard format using R? TelephoneData <- data.frame( FIRST = c("STAN", "FIONA", "JOHN", "VERA", "ROBERT", "ANGIE",…
dido
  • 77
  • 1
  • 7
-1
votes
2 answers

How to find substring from string in R?

If my string is a DNA sequence, x<-"TATAATGCAACGAGGGGCATAATTATATATGCCCAAAATCTGATATAATGACCGGGTAG" I want to extract substring from ATG to TAA, TGA or TAG. I am able to extract from one point to another by using stringi package with regex. My code is…
-1
votes
1 answer

How to Copy the Exact Match From Data B to Data A in r

Let's say I have two data frame A and B. A products price apple 3.0 orange 2.5 avocado 4.0 banana 2.5 blueberry 1.5 B products Color price banana Yellow NA Apple Red NA Avocado Green NA Apricot…
Fouad Selmane
  • 378
  • 2
  • 11
-1
votes
1 answer

Regular expression to search and replace a string in a file

Hi friends I am trying to search particular keywords (given in txt) in a list of files.I am using a regular expression to detect and replace the occurrence of the keyword in a file. Below is a comma separated keywords that i am passing to be…
OnkarK
  • 41
  • 9
-2
votes
1 answer

R how to match regex "_a (b)"

I am crazy about this question. In R language regex, how to match a pattern "_a (b)"? a and b both stand for a word, there is a space in front of (. library(stringr) x <- c("dum_drop (words)", "apple") # I want to match and remove the part "_drop…
Beryl
  • 39
  • 5
-2
votes
2 answers

Use multiple backreferences in a function to produce the replacement value in stringr functions in R

How can I use multiple backreferences in a function to produce the replacement in stringr functions, for example, in stringr::str_replace()? An example: suppose I want the replacement to be rounded to a whole number and concatenated into one string…
stevec
  • 41,291
  • 27
  • 223
  • 311
-2
votes
2 answers

Extract strings between special characters

Please help me in extracting the string from this text like id1:value1,id2:value2 id1:value1a,id2:value2a from "[{id1:value1,id2:value2},{id1:value1a,id2:value2a}]"
Santhosh N
  • 25
  • 6
-2
votes
1 answer

regex misunderstanding in r

I don't seem to understand gsub or stringr. Example: > a<- "a book" > gsub(" ", ".", a) [1] "a.book" Okay. BUT: > a<-"a.book" > gsub(".", " ", a) [1] " " I would of expected "a book" I'm replacing the full stop with a space. Also:…
Oli
  • 532
  • 1
  • 5
  • 26
-7
votes
2 answers

how to extract a specific portion of text from text file in r?

i have many text files containing text given below. \\ Paper: hep-th/9201003 From: DIJKGRAAF%IASSNS.BITNET@pucc.PRINCETON.EDU Date: Thu, 2 Jan 92 14:06 EST (54kb) Title: Intersection Theory, Integrable Hierarchies and Topological Field…
Alvi
  • 123
  • 1
  • 3
  • 14
1 2 3
19
20