vector<-c("0.78953744969927742", "0.46557689748480685", "0.19740881059705201",
"9.7073839462985714E-2", "4.9051709747422199E-2", "0.1167420589551126",
"0.12679434401288708", "0.51370748568563795", "0.1925345466801483",
"0.48287163643195624", "4.211984449707315E-2", "blablablab",
"0.10553766233766231", "7.8187250996015922E-2", "0.20718689788053954",
"1.6450511945392491E-2", "0.51752961082910309", "0.10978571428571428",
"0.42610062893081763", "0.52208333333333334", "0.27569868995633184",
"7.7189939288811793E-2", "0.53982300884955747", "38.25% (blablabla) blablablablablablablablablablablabla","0.22324159021406728")
我必须把所有的观察结果转换成数值。那些只由NA中的单词组成的。如果在一个以数字开头的观察结果之后有单词;仅检索数字。如果数字后有百分比,则删除这些百分比并仅保留数字
4条答案
按热度按时间xt0899hw1#
带有
readr
和parse_number
dxxyhpgq2#
清除所有垃圾
3b6akqbq3#
您可以使用
uklbhaso4#
这有点取决于regexp的具体类型,但这就足够了:
请访问www.example.com进行检查和优化regex101.com