• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: I need to copy numbers between two text strings in column, “transpose” it to columns next to the first text string

Resolved: I need to copy numbers between two text strings in column, “transpose” it to columns next to the first text string

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I need to copy numbers between two text strings in column, “transpose” it to columns next to the first text string and repeat through the rest of the column. Dataset has hundreds of rows.
The “alignment” (like putting NAs for correcting positions of numbers) is not necessary, transposing would be more than enough.
input:
desired output:
I was thinking along Extracting a string between other two strings in R
But did not make much progress :-/
Thanks in advance.

Answer:

Split on a regex-based logical:
(I defined the break points based on the presence of capital letters (i.e. [A-Z]); you may want to modify the pattern based on your expected break points in df1$column1.)

If you have better answer, please add a comment about this, thank you!

data-wrangling dataframe r string
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: navigate and redirect not redirecting to path in react router

24/03/2023

Resolved: Time Complexity: Find the number of people who know a secret leetcode 2327

24/03/2023

Resolved: Best way to create 3d matrix of variables in PULP

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.