0

如何在R编程中将“X”的列名与其下一列合并而无需硬编码

X 应该合并到 Day.7 X.1
应该合并到 Day.8 X.2
和 X.3 应该合并到 Day.9

代码

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)

输出

"G" "X"     "Day.7" "X.1"   "Day.8" "X.2"   "Day.9" "X.3"  

预期输出

"G" "Day.7"     "Day.7" "Day.8"   "Day.8" "Day.9"   "Day.9" "Day.9" 

PDF DATA 在此处添加:

此处添加 PDF DATA

4

0 回答 0