I have a url that should send a request for using date variables. The https address accepts date variables. I would like to assign dates in the address bar using something like the% formatting operator in Python. Does R have a similar operator, or do I need to rely on paste ()?
# Example variables year = "2008" mnth = "1" day = "31"
This is what I would do in Python 2.7:
url = "https:.../KBOS/%s/%s/%s/DailyHistory.html" % (year, mnth, day)
Or using .format () in 3. +.
The only thing I know to do in R looks verbose and relies on pasta:
url_start = "https:.../KBOS/" url_end = "/DailyHistory.html" paste(url_start, year, "/", mnth, "/", day, url_end)
Is there a better way to do this?
source share