は、この文字ベクトルトラブル、正規表現
columnsToKeep <- c("W","L","Customer Rate", "Diff% from Base",
"StoreOcc%", "COMPPS","Avail","Days in Unit",
"DSRC","Rec New Price", "Rec Rate Chg",
"intScheduledMoveOuts","TI30","BR1Yr",
"RLMI","NM7D","Last Rate Change %", "Occ%",
"Last Rate Change Amt", "BR", "MoveInRate",
"newRate",
"lengthOfStay", "mnyRentAtMoveIn",
"rentPriorToRateChange","mnyRentAtMoveOut","status")
を考えると、私はこのコード
`Customer Rate`+ Diff% `from Base`+ `Days in Unit`+ `Rec New Price`+ `Rec Rate Chg`+ `Last Rate Change`+ % `Last Rate Change`+ Amt
を生成するが、私はこの
をしたいd<-columnsToKeep[grepl(" ", columnsToKeep)]
cat(gsub("(\\%?\\w+\\s+\\w+\\s*\\w*)", '`\\1`+', d))
を試みます
`Customer Rate`+ `Diff% from Base`+ `Days in Unit`+ `Rec New Price`+ `Rec Rate Chg`+ `Last Rate Change %` + `Last Rate Change Amt`
明らかに、%記号の正しい正規表現を提供するのに苦労しています。
私はまったくの正規表現を使用することはありませんが::' paste0( "\'"、ペースト(columnsToKeep [greplあり得るには二つの方法( ""、columnsToKeep)]、collapse = "\' + \ '")、 "\' ")' – thelatemail