Skip to main content

All Questions

Tagged with
1 vote
1 answer
42 views

R split 1 column into several columns based on regex value

I have dataframe like this col_names Aceh..........................................................66.29..........................56.49..........................64.01....................................
salmiah-ls's user avatar
1 vote
2 answers
93 views

Replace variables in a formula with their definitions [closed]

I have the list of variables used, and their corresponding definitions. I also have the formulas provided, but I would like the translation of the formulas (provided in the example) to better ...
Stephen's user avatar
  • 505
-1 votes
0 answers
27 views

Can I extract different parts of a regex using parentheses in R? [duplicate]

I have some tough files to parse in my R program, namely some IgBlast output files. I was wondering if R allows me to match the lines I want with a regex, and extract different parts of the regex ...
DaniCee's user avatar
  • 2,859
1 vote
0 answers
38 views

How can searches too-large-for-regex be performed in DataTables in an R Shiny app?

I need to search a specific column in a DataTable for such a large number of terms that the table.search() using regex doesn't work. All of my search terms will either match exactly or not at all. Is ...
tomato_soup's user avatar
-2 votes
0 answers
31 views

How to get all occurrences of a string using regex in R? [duplicate]

Let's say I have a string Str1 -> "[18.01,19.023],[20.0289,20.9273],[32.474742,284.383732]" This is like a set of coordinates of type [x,y] and I want to extract all the "x" and ...
Miguel_s's user avatar
-1 votes
0 answers
21 views

regex: Can't catch first occurence of character group [duplicate]

I have column names like this: var1, var2, var3, .... var99. but sometimes there are wrong entries between var and the number, something like var dfdsf 22. I want to extract only the relevant part, ...
LulY's user avatar
  • 1,058
1 vote
0 answers
22 views

R: how to replace string with digit after capturing group [duplicate]

I need to transform strings like 333bis into 33300, so I set up a regex pattern like (\d{3})(bis), but I can't use \100 as substitute pattern, because it will be interpreted as "group 100". ...
eazyezy's user avatar
  • 79
2 votes
1 answer
64 views

Extract *all* possible patterns in a variable

I have a large variable containing strings (words). I need to extract all substrings that contain any of the patters listed in a separate vector. library(tidyverse) df <- data.frame(Word = c("...
RobertP.'s user avatar
  • 285
1 vote
1 answer
66 views

Extracting all characters from the beginning of a string through the first 5 digits of last portion of string?

I am working in R with some really messy address data and have been able to solve every issue except one. At the end of the address string, where the zip code is -- there is often 1, 2, or 3 ...
James Snay's user avatar
5 votes
5 answers
140 views

Convert latitude and longitude string vector into data frame

I am struggling to parse the location strings I have in my data. The location is inconveniently set up as a string with both the latitude and longitude info bundled together and I want to extract that ...
Jennifer's user avatar
3 votes
1 answer
66 views

Recreating Regex Functions by Hand

As a learning exercise, I am trying to re-create a regex expression in R the manual way. For example, suppose I have this string: var1 <- c("111 222 a1C 5b2", "B2G-6l3 atttr", &...
konofoso's user avatar
  • 161
1 vote
2 answers
88 views

How to use regular expression to match two words that have alphabetically-adjacent first letter?

I recently learnt that () can be used for define patterns in regular expression, and use \\1 can refer to the first set of string defined in the (). It is a powerful idea because I can use it to ...
Grasshopper_NZ's user avatar
3 votes
3 answers
177 views

How to remove duplicate character sequences within a string? [closed]

I have a column in a tibble that should always have an 8-character string as its value, for example ABCDEF12. Unfortunately, I sometimes get values with a duplication of 2 characters in the string, ...
pure_func's user avatar
2 votes
3 answers
100 views

Extract Street Name from Address in R

I am trying to extract the street names from a street address. I just want to extract the street/house number at the beginning of the string, and extract everything after the last street suffix (RD, ...
ra_learns's user avatar
  • 111
1 vote
0 answers
51 views

Using gsub to remove specific characters([ and ]) in R [duplicate]

I want to remove '[' and ']' from the string. When I use gsub("\\[|\\]", "", str), it works properly; but when I use gsub("[\\[\\]]", "", str), it doesn't work ...
Hakuna Matata's user avatar

15 30 50 per page
1
2 3 4 5
495