# construct from character vector
ip_interface(c("192.168.0.1/10", "2001:db8:c3::abcd/45"))
# construct from address + prefix length objects
ip_interface(ip_address(c("192.168.0.1", "2001:db8:c3::abcd")), c(10L, 45L))
# extract IP address
x <- ip_interface(c("192.168.0.1/10", "2001:db8:c3::abcd/45"))
as_ip_address(x)
# extract IP network (with host bits masked)
as_ip_network(x)
Run the code above in your browser using DataLab