我有一些包含数字的字符串如下:
972 2 6424979
81|5264627
49-0202-2801986
07.81.48.27.89
0664/3420034
06041 - 8728
我希望你能够输出如下内容:
97226424979
815264627
4902022801986
0781482789
06643420034
060418728
我尝试使用:
as.numeric(gsub("([0-9]+).*$", "\\1", numbers))
但输出的数字是分开显示的。
as.numeric(gsub('\\D+', '', numbers))
- Sotos[1] 9.722642e+10 8.152646e+08 4.902023e+12 7.814828e+08 6.643420e+09 6.041873e+07
。 - Sotos