Learn R Programming

SciencesPo (version 1.3.9)

has.domain: Find WWW Domains

Description

Hand function to return the www domain.

Usage

has.domain(x)

Arguments

x
A vector from which the domain information is desired.

Examples

Run this code
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