Lifecycle: maturing CRAN status R build status Coverage status

This package provides classes for working with IP addresses, inspired by the Python ipaddress module.

Here are some of the features:


You can install the released version of ipaddress from CRAN with:


Or you can install the development version from GitHub:

# install.packages("remotes")


This package provides the ip_address() and ip_network() classes, which can be used as standalone vectors or as columns within data frames and tibbles.


x <- tibble(
  address = ip_address(c("", "2001:db8::8a2e:370:7334")),
  network = ip_network(c("", "2001:db8::/48"))

#> # A tibble: 2 x 2
#>                   address          network
#>                 <ip_addr>       <ip_netwk>
#> 1   
#> 2 2001:db8::8a2e:370:7334    2001:db8::/48

Input character vectors are validated as they are parsed. Invalid inputs raise a warning and are replaced with NA.

ip_address(c("", ""))
#> Warning: Invalid value on row 2:
#> <ip_address[2]>
#> [1] <NA>

Functions are provided to enable common tasks:

mutate(x, ipv6 = is_ipv6(address), in_net = is_within(address, network))
#> # A tibble: 2 x 4
#>                   address          network ipv6  in_net
#>                 <ip_addr>       <ip_netwk> <lgl> <lgl> 
#> 1    FALSE FALSE 
#> 2 2001:db8::8a2e:370:7334    2001:db8::/48 TRUE  TRUE

Please note that the ‘ipaddress’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.