I am working with R trying to use the sprintf function to print multiple urls. The URL is in the form http://www.weather.unh.edu/data/year/day.txt. I want to print the url for each day of multiple years. I tried:
day <-c(1:365)
year <-c(2001:2004)
urls<- sprintf("http://www.weather.unh.edu/data/%s/%s.txt", year, day)
but received the error
Error in sprintf("http://www.weather.unh.edu/data/%s/%s.txt", year, day) :
arguments cannot be recycled to the same length
I am printing these urls so I can import raw data from them in bulk. If anyone has any idea how to make this work with sprintf or another function please let me know