The following is a script you can use to scrape Treasury data:

getTreasury<-function(url,target,cleantarget){
download.file(url,target)
treasurytemp<-read.csv(target,stringsAsFactors = F)
names(treasurytemp)<-c(“date”,”rate”)
treasurytemp<-treasurytemp[6:nrow(treasurytemp),]
treasurytemp$date<-as.Date(treasurytemp$date)
write.csv(treasurytemp,cleantarget,row.names=FALSE)
}

urls<-c(“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=e30653a4b627e9d1f2490a0277d9f1ac&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,

“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=c66ea77a2e8f0919c5133c7633065908&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=b4cf23d5fc7bf08bbf59a7c87e11d3c8&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=fbb02942bfdbff31a479e98bcbe26388&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=fb131124a7aeacaf7f4822c4742d5482&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=bcb44e57fb57efbe90002369321bfb3f&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=27f0815d23884776d16f28288a09804a&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=f4145c30271d4427c1eb0ed5b5edb69f&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”,
“http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=bb7ecadcd48b2e66ce57c6d4f3f74453&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn”
)

targets<-#write the filepath for any scraping you may have done in the past cleantargets<-#write the filepath for where you want to write future scrapes to k<-length(urls)
sapply(1:k,function(x) do.call(getTreasury,list(urls[x],targets[x],cleantargets[x])))