'How to merge specific columns with its next column without hardcoding in R programming
How to merge column names that are "X" with its next column without hardcode in R programming
X should be merged to Day.7
X.1 should be merged into Day.8
X.2 and X.3 should be merged into Day.9
Code:
library(data.table)
library(tabulizer)
pdf_file <- "new.pdf"
out2 <- extract_tables(pdf_file, pages =c(89), output = "data.frame")
out2<-as.data.table(out2)
colnames=colnames(out2)
output:
"G" "X" "Day.7" "X.1" "Day.8" "X.2" "Day.9" "X.3"
Expected Output:
"G" "Day.7" "Day.7" "Day.8" "Day.8" "Day.9" "Day.9" "Day.9"
PDF DATA is added here:

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
