Learn R Programming

ipaddress (version 0.2.0)

packed: Represent address as raw bytes

Description

as_packed() and from_packed() encode and decode an ip_address vector to a blob::blob vector.

Usage

as_packed(ip)

from_packed(bytes)

Arguments

ip

An ip_address vector

bytes

A blob::blob vector

Value

Details

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

IPv4 addresses use 4 bytes, IPv6 addresses use 16 bytes, and missing values are encoded as NULL.

See Also

Use as_binary() and from_binary() to encode/decode binary.

Examples

Run this code
# NOT RUN {
x <- ip_address(c("192.168.0.1", "2001:db8::8a2e:370:7334", NA))
as_packed(x)

from_packed(as_packed(x))
# }

Run the code above in your browser using DataLab