Learn R Programming

RWsearch (version 4.7.0)

RWsearch-package: Package RWsearch

Description

Search by keywords in R packages, task views, CRAN, the web and display the results in console, txt, html or pdf pages. Download the whole documentation (html index, pdf manual, readme, vignettes, source code, etc) with a single instruction, either in a flat format or in subdirectories defined by the keywords. Visualize the package dependencies. Several functions for task view maintenance and exploration of CRAN archive. Quick links to more than 70 web search engines. Lazy evaluation of non-standard content is available throughout the package and eases the use of many functions. Packages RWsearch and pacman share the same syntax and complement each other. Inspired by packages ctv, foghorn, latexpdf, pacman, sos.

Arguments

Examples

Run this code
# NOT RUN {
### NON-STANDARD CONTENT - NON-STANDARD EVALUATION
## Non-standard content (nsc1, nsc2), standard content ("stc3", "double word4") 
## and regular object (obj) stored in .GlobalEnv can be merged with cnsc()
obj <- c("obj5", "obj6")
cnsc(nsc1, nsc2, "stc3", "double word4", obj)

### DOWNLOAD CRANDB
## In real life, download crandb from CRAN or load it from your directory 
## with functions crandb_down() or crandb_load(). 
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))

### SEARCH IN CRANDB
## Search in crandb. Use standard or non-standard content. 
## Display the results in a vector or in a list.
s_crandb(search, find, cran, web)
s_crandb(search, find, cran, web, select = "PD", mode = "relax")
s_crandb(c("thermodynamic", "chemical reaction"))
(lst <- s_crandb_list(thermodynamic, "chemical reaction"))
# }
# NOT RUN {
### DISPLAY THE RESULTS
## in the console, in (txt, md, pdf) files or in the browser.
p_table2(lst)
p_table7pdf(lst, dir = file.path(tempdir(), "ptable"), cleantex = FALSE, openpdf = TRUE)
p_text(lst, dir = file.path(tempdir(), "ptext2"), editor = TRUE,  
           repos = "https://cloud.r-project.org")
p_text2pdf(lst, dir = file.path(tempdir(), "ptext2"), cleantex = FALSE,  
           openpdf = TRUE, repos = "https://cloud.r-project.org")
p_display(lst, dir = tempdir())
 
### VISUALIZE THE DOCUMENTATION 
## from installed packages or U. Pennsylviana in the browser
p_html(brew, sig) 
p_htmlweb(foghorn) 
p_pdfweb(sos, repos = "https://cloud.r-project.org")

### DOWNLOAD THE DOCUMENTATION
## Vector => download in the "docpkgs" directory ("." is for current directory)
## List   => download in subdirectories named after the keywords
## (non-standard content is accepted)
p_down(pacman, pdfsearch, sos, dir = file.path(tempdir(), "pdown"),  
       repos = "https://cloud.r-project.org")
p_down(lst, dir = file.path(tempdir(), "pdown"), repos = "https://cloud.r-project.org")

### SEARCH WITH sos (U. PENNSYLVANIA)
s_sos("chemical reaction")
res <- s_sos(distillation)
as.data.frame(res)
res

### LAUNCH WEBSITES AND SEARCH ENGINES
h_ttp("www.r-project.org")
h_cranbydate(repos = "https://cloud.r-project.org")
h_yt("Serge Gainsbourg Ne dis rien")
h_so(R, deep, neural, network)
h_osm("La Ferriere sous Jougne")
h_mw(recension)
h_lexilogos()
# }
# NOT RUN {
### TASK VIEW MAINTENANCE
## In real life, download crandb and tvdb from CRAN or load them from your directory 
## with functions crandb_down(), crandb_load(), tvdb_down(), tvdb_load(). 
## In this example, we use small files.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))
tvdb_load(system.file("data", "ztvdb.rda", package = "RWsearch"))

## List the task views
tvdb_vec()
tvdb_pkgs(gR, Genetics, Robust)

## Search for some packages in the task views
s_tvdb(actuar, FatTailsR, MASS, zoo, nopackage)

## Search for the recent packages in crandb that contain the keyword 
## and verify if the packages are already refereed in the task view.
## from = "2017-01-01" and "2018-01-01" are selected for this small example.
s_crandb_tvdb("distribution", tv = "Distributions", from = "2017-01-01")
s_crandb_tvdb("distribution", tv = "Distributions", from = "2018-01-01")
# }
# NOT RUN {
### EXPLORE CRAN ARCHIVE AND DOWNLOAD OLD tar.gz FILES
## In real life, download archivedb and crandb from CRAN
## with the functions archivedb_down() and crandb_down().  
## In this example, we load two small files (50 and 43 packages).
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))
archivedb_load(system.file("zarchive", "zCRAN-archive.html", package = "RWsearch")) 
archivedb_npkgs()
lapply(archivedb_list(), tail)

## Download the latest tar.gz version from CRAN archive 
## (this works for both both existing and removed packages).
p_downarch(fitur, zmatrix, dir = file.path(tempdir(), "pdownarch"))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab