全角カッコの中にある全角数字を半角にして取り出したい
以下のような文字列があった時に1を1として取り出し、他はNAとしたい。
smp <- c("新しいファイル(1)","嫁") library(magrittr) library(Nippon) library(stringr) smp %>% zen2han() %>% str_extract("(\\d)") %>% str_replace_all("(|)","")
以下のような文字列があった時に1を1として取り出し、他はNAとしたい。
smp <- c("新しいファイル(1)","嫁") library(magrittr) library(Nippon) library(stringr) smp %>% zen2han() %>% str_extract("(\\d)") %>% str_replace_all("(|)","")