Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ip_to_binary

Represent address as binary


Description

Encode or decode an ip_address as a binary bit string.

Usage

ip_to_binary(x)

binary_to_ip(x)

Arguments

x
  • For ip_to_binary(): An ip_address vector

  • For binary_to_ip(): A character vector containing only 0 and 1 characters

Details

The bits are stored in network order (also known as big-endian order), which is part of the IP standard.

IPv4 addresses use 32 bits, IPv6 addresses use 128 bits, and missing values are encoded as NA.

Value

  • For ip_to_binary(): A character vector

  • For binary_to_ip(): An ip_address vector

See Also

Examples

x <- ip_address(c("192.168.0.1", "2001:db8::8a2e:370:7334", NA))
ip_to_binary(x)

binary_to_ip(ip_to_binary(x))

ipaddress

Tidy IP Addresses

v0.5.1
MIT + file LICENSE
Authors
David Hall [aut, cre] (<https://orcid.org/0000-0002-2193-0480>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.