Last chance! 50% off unlimited learning
Sale ends in
Identify the form (IPv4 or IPv6) of a vector of IP addresses. This can also be used to validate IPs.
ip_classify(ip_addresses)
a vector of IPv4 or IPv6 IP addresses.
a vector containing the class of each input IP address; either "IPv4", "IPv6" or, for IP addresses that were not valid, NA.
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.
# NOT RUN {
#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
# }
Run the code above in your browser using DataLab