我有三种组合:
10 20 30 40
ab bc cd da
clim dlim alim blim
还有一个网址:
www.climdata.com
基本上,我想用url创建所有3种组合的列表,我可以使用curl来下载文件:
www.climdata.com/10abclim.zip
www.climdata.com/10abdlim.zip
www.climdata.com/10abalim.zip
www.climdata.com/10abblim.zip
www.climdata.com/20abclim.zip
www.climdata.com/20abdlim.zip
www.climdata.com/20abalim.zip
www.climdata.com/20abblim.zip
www.climdata.com/10bcclim.zip
www.climdata.com/10bcdlim.zip
www.climdata.com/10bcalim.zip
www.climdata.com/10bcblim.zip
等
答案 0 :(得分:2)
我们可以将expand.grid
与paste
paste0(do.call(paste0, expand.grid(list(paste0(link1, "/"), v1, v2, v3))), ".zip")
v1 <- c(10, 20, 30, 40)
v2 <- c('ab', 'bc', 'cd', 'da')
v3 <- c('clim', 'dlim', 'alim', 'blim')
link1 <- 'www.climdata.com'