ip_classify: Identify whether an IP address is IPv4 or IPv6

View source: R/RcppExports.R

ip_classifyR Documentation

Identify whether an IP address is IPv4 or IPv6

Description

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

Usage

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


#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


hrbrmstr/iptools documentation built on Jan. 10, 2023, 2:54 a.m.