tld_extract: Extract TLDs

Description Usage Arguments Value See Also Examples

View source: R/suffix.R

Description

tld_extract extracts the top-level domain (TLD) from a vector of domain names. This is distinct from the suffixes, extracted with suffix_extract; TLDs are top level, while suffixes are just domains through which internet users can publicly register domains (the difference between .org.uk and .uk).

Usage

1
tld_extract(domains, tlds = NULL)

Arguments

domains

a vector of domains, retrieved through url_parse or domain.

tlds

a dataset of TLDs. If NULL (the default), tld_extract relies on urltools' tld_dataset; otherwise, you can pass in the result of tld_refresh.

Value

a data.frame of two columns: domain, with the original domain names, and tld, the identified TLD from the domain.

See Also

suffix_extract for retrieving suffixes (distinct from TLDs).

Examples

1
2
3
4
5
6
# Using the inbuilt dataset
domains <- domain("https://en.wikipedia.org/wiki/Main_Page")
tld_extract(domains)

# Using a refreshed one
tld_extract(domains, tld_refresh())

Ironholds/urltools documentation built on Oct. 1, 2020, 2:03 p.m.