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
0
votes
3 answers

using stringr::str_detect to detect if a string appears after a character have appeared 4 times

Not sure I worded my question all that well but its essentially what I am trying to do. Data example: Data <- c("NELIG_Q1_1_C1_A", "NELIG_N1_1_EG1_B", "NELIG_V2_1_NTH_C", "NELIG_Q2_1_C5_Q", "NELIG_N1_1_C1_RA", "NELIG_Q1_1_EG1_QR",…
Checht
  • 45
  • 10
0
votes
1 answer

identifying strings in folder names to create variables (stringi r)

I hope this finds you well. I have a list of csv files that use a convention similar to this one, "SubB1V2timecourses_chanHbO_Cond2_202010281527" I want to merge all of the files in the dataset and add in variables such as ID (B1V2), chromophore…
Caroline
  • 37
  • 6
0
votes
2 answers

str_c using " in R

Could someone please help me while I'm trying to build this final line: [1] ("mercury" AND "earth" AND "Jupiter" AND "Uranus" AND "Pluto?") By using below code df <- structure(list(AND = c("mercury", "earth", "Jupiter", "Uranus", "Pluto?"), OR =…
MelaniaCB
  • 427
  • 5
  • 16
0
votes
2 answers

Count number of exactly matching words in a string

I have a tibble with an id column and a column that capture some text_entry that people inputted. Goal: Compare each person's text_entry to a key and count the number of perfectly typed words. For example, if my inputs were: df <- tribble(~id,…
wscampbell
  • 351
  • 2
  • 11
0
votes
0 answers

Retrieve broken Vietnamese string variables in R

I have a dataset from Vietnam. But when I read it in R, the string variables are imported incorrectly. I used stri_trans_general from the stringi package, however it works on only a few columns. I checked the raw dataset and it seems those few…
drhnis
  • 113
  • 1
  • 2
0
votes
2 answers

Create New Lists Based on List Structure Pattern

I have some data that looks like this: dat <- c("Sales","Jim","Halpert","","", "Reception","Pam","Beasley","","", "Not.Manager","Dwight","Schrute","Bears","Beets","BattlestarGalactica","","", …
bstrain
  • 278
  • 1
  • 9
0
votes
2 answers

Using partial strings to create new variables (repost)

I was hoping I could pick your brains as to how to convert my data to long form in R. I would like to separate out the condition, Chromophore, and source detector from the variable names in my dataframe. Below I pasted a few examples (but there are…
Caroline
  • 37
  • 6
0
votes
1 answer

Select strings from list where logical value is TRUE

I would like to extract duplicated strings from a list. As, the unique function does not work on non-numerical data, I used the stringi package with the stri_duplicated function to obtain logical values (TRUE or FALSE). I would like to extract the…
ABiologist
  • 43
  • 6
0
votes
0 answers

matching strings regex exact match

This thread follows on from this answered qestion: Matching strings loop over multiple columns I opened a new thread as I would like to make an update to flag for exact matches only.. I have a table of key words in separate colums as follows: #codes…
Keelin
  • 367
  • 1
  • 10
0
votes
1 answer

match strings exactly on lookup table in R

I have a table of lookup values with patterns to look for and replacements, but the patterns have strings containing one another and I want to match them exactly. lookup <- tibble( pattern = c("ONE", "ONET", "ONETR"), replacement = c("one new",…
MayaGans
  • 1,815
  • 9
  • 30
0
votes
1 answer

Best way to rename variables matching different naming patterns to denote time in consistent manner?

I have a wide dataset that has psychometric measures taken from participants across various timepoints. Time varying labels within the psychometric measures are in the form: QuestionnaireTime_Item#. An example is dass1_1 where dass = Questionnaire,…
Atanas Janackovski
  • 348
  • 1
  • 2
  • 12
0
votes
1 answer

regex/stringr: splitting joined/sequence of countrynames

I have a string which contains multiple country names put together. The names are not separated by any pattern other than that a capital letter follows a small letter without a space (spaces are however part of some country name, e.g. Democratic…
zoowalk
  • 2,018
  • 20
  • 33
0
votes
1 answer

There is no package called 'stringi' when using library 'car'

Purpose I was trying to use vif() function from the car package of R. Initial Error Messages When I first executed vif(X), an error message popped up as: Error in vif(mod1) : could not find function "vif" I tried library(car) and get a following…
Jeff Hu
  • 714
  • 1
  • 8
  • 20
0
votes
1 answer

Converting from NCR to Unicode in R

I have some html files (I'm working with them as plain texts) that utilize decimal NCR to encode special characters. Is there a way to convert them conveniently to Unicode using R? NCR codes does not always have one-on-one match with unicode and it…
perechen
  • 125
  • 9
0
votes
0 answers

Cannot install Stringi for R (R-studio 1.1.456, OS X 10.15.2 Catalina)

I get the following error when trying to install stringi: trying URL 'https://cran.rstudio.com/src/contrib/stringi_1.4.5.tar.gz' Content type 'application/x-gzip' length 7284255 bytes (6.9…