Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您可以使用与此处相同的答案,只需将呼叫中的逗号 ( ,) 更改为转义句点 ( \\.)gsub即可删除句点。
,
\\.
gsub
假设输入是字符类型开始,这应该工作 -
library(data.table) dt <- data.table(dt) dt[,input := as.numeric(gsub(input,pattern='[.]',replacement='')), by = 'input']