All Questions
7,415
questions
1
vote
1
answer
36
views
How to parse pdf in r and then correctly convert or extract spaced/tabbed pieces of text into columns of dataframe?
I am reading a pdf in r using library(pdftools)
library(tidyverse)
library(pdftools)
library(lubridate)
pdf_rowwise <- strsplit(pdf_text("V://path//sample.pdf"), split = "\n")
...
1
vote
1
answer
44
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....................................
1
vote
2
answers
107
views
Replace variables in a formula with their definitions [closed]
I have the list of variables 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 understand ...
-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 ...
1
vote
0
answers
39
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 ...
-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 ...
-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, ...
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". ...
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("...
1
vote
1
answer
67
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 ...
5
votes
5
answers
141
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 ...
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", &...
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 ...
3
votes
3
answers
181
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, ...
2
votes
3
answers
101
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, ...