Learn R Programming

webtrackR (version 0.3.2)

extract_path: Extract the path from URL

Description

extract_path() adds the path of a URL as a new column. The path is defined as the part following the host but not including a query (anything after a "?") or a fragment (anything after a "#").

Usage

extract_path(wt, varname = "url", decode = TRUE)

Value

webtrack data.frame with the same columns as wt and a new column called 'path' (or, if varname not equal to 'url', '<varname>_path')

Arguments

wt

webtrack data object

varname

character. name of the column from which to extract the host. Defaults to "url".

decode

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

Examples

Run this code
if (FALSE) {
data("testdt_tracking")
wt <- as.wt_dt(testdt_tracking)
# Extract path
wt <- extract_path(wt)
}

Run the code above in your browser using DataLab