0
R 벡터화를 사용하여 for 루프를 제거하려면 어떻게해야합니까?for 루프를 제거하기 위해 stringr str_match를 벡터화
library(stringr)
url <- c("http://www.slate.fr/france/87869/mehdi-nemmouche-bruxelles", "http://www.slate.fr/story/87347/turquie-opposition-geek", "http://www.slate.fr/grand-format/paysages-debarquement-photos-1944-aujourdhui")
for (i in 1:length(url)) {
a[i]<-str_match(url[i], "http://.*slate.fr/(.*?)/")[2]
}
이 작동하지 않습니다
a<-str_match(url, "http://.*slate.fr/(.*?)/")[2]