URL: Create a URL S3 object

Description Usage Arguments Value Examples

View source: R/URL.R

Description

Create a URL S3 object

check if URL object

conver as.character() string from of object to URL object

conver string form of object to URL object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
URL(url, base = paste0("file://", getwd()), src = NULL, id = NULL,
  meta = c(), classes = NULL, ...)

is.URL(x)

as.URL(x, ...)

## Default S3 method:
as.URL(x, ...)

## S3 method for class 'list'
as.URL(x, ...)

## S3 method for class 'URL'
as.character(x, ...)

as.URL_row(x, ...)

## Default S3 method:
as.URL_row(x, ...)

Arguments

url

string url rapresentation

base

a base url for relative urls (string or URL)

src

an URL object fron which this object is derived

id

entry id (taken from named list/array)

meta

an optional array of meta attributes

classes

extra classes to include (between schema and id)

...

other arguments passed to specific methods

x

an arbitrary object or an object of S3 class URL

Value

an URL object

check condition

an URL object

an named list of data.frame columns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# simple scalar construction
u <- URL('http://www.w3c.org')
as.character(u)
print(u)

## Not run: 
str(u)

## End(Not run)

# "derived" URL
u2 <- URL('http://ietf.org', ,src='http://www.w3c.org')
as.character(u2)
as.character(u2$src)

# default schema ('file://') with defaults

s1 <- URL('/etc/R/Renvironment')
s2 <- URL('hosts',base='/etc')
s3 <- URL('.Rhistory')
s4 <- URL('~/.Rprofile')
s5 <- URL('.Rprofile', base='~')

sapply(list(s1,s2,s3,s4,s5), as.character)

# construction from a (named) character vector and data.frame cast
l <- c(
    w3c='http://www.w3c.org',
    ietf='http://ietf.org',
    iana='http://www.iana.org',
    hosts='hosts',
    'R env'='/etc/R/Renviron'
 )

 uz <- URL(l, src=URL('https://cran.r-project.org/'), base='/etc')

 df <- as.data.frame(as.URL_list(uz))

 head(df,nrow(df))

hute37/urlr documentation built on May 17, 2019, 9:14 p.m.