Here is the text:
data$charge[1]
[1] "Count #1 as Filed: In Violation of; 21 O.S. 645; Count #2 as Filed: In Violation of; 21 O.S. 1541.1;Docket 1"
I am currently trying to extract statutes from legal data. My code looks like this:
str_extract_all(data$charge[1:3], "(?<=Violation of;)(\\D|\\d){4,20}(?=;Count |;Docket)")
[[1]]
[1] "21 O.S. 645" "21 O.S. 1541.1"
[[2]]
[1] "21 O.S. 1435 "21 O.S. 1760(A)(1)
[[3]]
[1] "21 O.S. 1592"
And I'd like to add them as columns to a data frame like this:
id name statute1 statute2 statute3
1 BLACK, JOHN 21 O.S. 645 21 O.S. 1541.1 NA
2 DOE, JANE 21 O.S. 1435 21 O.S. 1760(A)(1) NA
3 ROSS, BOB 21 O.S. 1592 NA NA
Thank you! Does that make sense?