Learn R Programming

adaR (version 0.3.4)

ada_set_href: Set a specific component of URL

Description

These functions set a specific component of URL.

Usage

ada_set_href(url, input, decode = TRUE)

ada_set_username(url, input, decode = TRUE)

ada_set_password(url, input, decode = TRUE)

ada_set_port(url, input, decode = TRUE)

ada_set_host(url, input, decode = TRUE)

ada_set_hostname(url, input, decode = TRUE)

ada_set_pathname(url, input, decode = TRUE)

ada_set_protocol(url, input, decode = TRUE)

ada_set_search(url, input, decode = TRUE)

ada_set_hash(url, input, decode = TRUE)

Value

character, NA if not a valid URL

Arguments

url

character. one or more URL to be parsed

input

character. containing new component for URL. Vector of length 1 or same length as url.

decode

logical. Whether to decode the output (see utils::URLdecode()), default to TRUE

Examples

Run this code
url <- "https://user_1:password_1@example.org:8080/dir/../api?q=1#frag"
ada_set_href(url, "https://google.de")
ada_set_username(url, "user_2")
ada_set_password(url, "hunter2")
ada_set_port(url, "1234")
ada_set_hash(url, "#section1")
ada_set_host(url, "example.de")
ada_set_hostname(url, "example.de")
ada_set_pathname(url, "path/")
ada_set_search(url, "q=2")
ada_set_protocol(url, "ws:")

Run the code above in your browser using DataLab