longer object length is not a multiple of shorter object length
> str_c(c("a","b"), c("d","e","f")) Warning in stri_c(..., sep = sep, collapse = collapse, ignore_null = TRUE) : longer object length is not a multiple of shorter object length [1] "ad" "be" "af"
cross-product combination of two string arrays
fstS <- c("a","b") sndS <- c("d","e","f") str_c(fstS, sndS) # 원하는 결과가 아님.. # [1] "ad" "be" "af" # [1] "ad" "bd" "ae" "be" "af" "bf" # stringr str_c( rep(fstS, each=length(sndS)), sndS) # apply expand.grid(fstS, sndS) %>% apply(1, str_c, collapse="") do.call(str_c, expand.grid(fstS, sndS)) # data.table CJ(fstS, sndS)[ , str_c(fstS, sndS)] # base outer(fstS, sndS, str_c) %>% as.vector() # purrr cross(list(fstS, sndS)) %>% map_chr(str_c, collapse="") cross2(fstS, sndS) %>% map_chr(str_c, collapse="")