ip_to_subnet: Create an IPv4 network from an address and prefix length.
Description
Given a character vector of IP addresses in CIDR notation (e.g. 1.2.3.4/24)
or a character vector of IP addresses and an integer vector of prefix lengths,
return a character vector of the network (in CIDR notation).
Usage
ip_to_subnet(ip_addresses, prefix_lengths = NULL)
Arguments
ip_addresses
either a character vector of IP addresses in CIDR notation
(e.g. 1.2.3.4/24) --- in which case prefix_lengths should be NULL ---
or a character vector of IP addresses --- in which case prefix_lengths should
be a character vector of the same length as ip_addresses.
prefix_lengths
should be NULL (the default) if ip_addresses is a
a character vector of IP addresses in CIDR notation otherwise should be
a character vector of the same length as ip_addresses.