port: Get or set a URL's port

Description Usage Arguments See Also Examples

View source: R/accessors.R

Description

as in the lubridate package, individual components of a URL can be both extracted or set using the relevant function call - see the examples.

Usage

1
2
3
port(x)

port(x) <- value

Arguments

x

a URL, or vector of URLs

value

a replacement value (or vector of replacement values) for x's port. If NULL, the port will be entirely removed.

See Also

scheme, domain, path, parameters and fragment for other accessors.

Examples

1
2
3
4
5
6
7
8
9
# Get the port
example_url <- "http://cran.r-project.org:80/submit.html"
port(example_url)

# Set the port
port(example_url) <- "12"

# Remove the port
port(example_url) <- NULL

Example output

[1] "80"

urltools documentation built on May 1, 2019, 6:49 p.m.