ip_classify: Identify whether an IP address is IPv4 or IPv6

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

Identify the form (IPv4 or IPv6) of a vector of IP addresses. This can also be used to validate IPs.

Usage

1
ip_classify(ip_addresses)

Arguments

ip_addresses

a vector of IPv4 or IPv6 IP addresses.

Value

a vector containing the class of each input IP address; either "IPv4", "IPv6" or, for IP addresses that were not valid, NA.

See Also

is_valid et al for logical checks of IP addresses, ip_to_hostname for resolving IP addresses to their hostnames, and ip_to_numeric for converting (IPv4) IP addresses to their numeric representation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#IPv4
ip_classify("173.194.123.100")
#[1] "IPv4"

#IPv6
ip_classify("2607:f8b0:4006:80b::1004")
#[1] "IPv6"

#Invalid
ip_classify("East Coast Twitter is Best Twitter")
#[1] NA

iptools documentation built on Sept. 10, 2021, 5:06 p.m.