gia*_*iac 3 regex r gsub grepl
我想清理这个向量,只保留数字
vec = c(" 4010 \"Filling in time budget diary\"", " 8888 \"Prob cont. preceding activity\"", " 9999 \"Missing, undecipherable\";")
Run Code Online (Sandbox Code Playgroud)
我想要的只是: 4010, 8888, 9999
我想到了类似的东西,完全匹配数字,但它不起作用.
gsub("^[[:digit:]]$", replacement = '', vec)
Run Code Online (Sandbox Code Playgroud)
谢谢