Functions for parsing and handling URLs in R