x1 <- "http://stackoverflow.com/questions/19020749/function-to-extract-domain-name-from-url-in-r"
x2 <- "http://www.talkstats.com/"
x3 <- "www.google.com"
has.domain(x3)
sapply(list(x1, x2, x3), has.domain)
Run the code above in your browser using DataLab