unionRSiteSearch: Combine RSiteSearch Objects

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/unionRSiteSearch.R

Description

Combines to RSiteSearch objects into a new RSiteSearch object with only one row for any help page duplicated between the two. unionRSiteSearch removed the duplicate entries. intersectRSiteSearch keeps only the duplicates.

Usage

1
2
3
4
5
6
7
unionRSiteSearch(x, y, sort.=NULL)
intersectRSiteSearch(x, y, sort.=NULL)

## S3 method for class 'RSiteSearch'
Ops(e1,e2)
# This supports "|" for "unionRSiteSearch"
# and "&" for "intersectRSiteSearch".

Arguments

x, y

objects of class RSiteSearch.

sort.

Optional sort. argument used by sortRSiteSearch and RSiteSearch.function. Default is the sort. argument in attr(x, 'call').

e1, e2

objects of class RSiteSearch.

Details

1. xy <- rbind(x, y)

2. For any (Package, Function) appearing in both x and y, the row with the largest Score is retained and the other is deleted.

3. Apply sortRSiteSearch to the rebuild the summary and sort the result as desired.

4. attr(xy, 'hits') <- c(attr(x, 'hits'), attr(y, 'hits'))

Value

an object with class c('RSiteSearch', 'data.frame') as returned by sortRSiteSearch and RSiteSearch.function.

Note

Binary operators & and | are implemented for the S3 class RSiteSearch

Author(s)

Spencer Graves and Romain Francois

See Also

RSiteSearch.function sortRSiteSearch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
des1 <- RSiteSearch.function('differential equations', 1)
de1 <- RSiteSearch.function('differential equation', 1)
# each retrieves 1 page of 20 hits
# but not the same 20

de.s <- unionRSiteSearch(des1, de1)
# combines the two, eliminating duplicates.

# or the sorter version:
de.s <- des1 | de1

# Keep only the common entries.
de2 <- intersectRSiteSearch(des1, de1)
de2 <- des1 & de1

# summary and HTML still work with the combined object.
summary(de.s)
HTML(de.s)

summary(de2)
HTML(de2)

RSiteSearch documentation built on May 31, 2017, 3:47 a.m.