Learn R Programming

PolitwoopsR (version 1.0)

url_domain: Get domains from URLs

Description

Extract the domain from a full url (e.g. "google.com" from "https://www.google.com/calendar/render")

Usage

url_domain(urls, extended = F)

Arguments

urls
Single URL or a vector of URLs.
extended
If TRUE, returns the domain with a subomain (if present). For instance, "www.domain.com/sub/blah/meh.html" would return "domain.com/sub". Defaults to FALSE.

See Also

get_pw_tweets get_pw_pol merge_pw url_expand

Examples

Run this code
url_domain("https://www.google.com/search?num=100&q=politwoops")

url_domain("www.domain.com/sub/blah/meh.html", extended=TRUE)

Run the code above in your browser using DataLab