Type: Package
Title: Get XKCD Comic from R
Version: 1.9.2
Date: 2020-02-24
Maintainer: Paolo Sonego <paolo.sonego@gmail.com>
Description: Visualize your favorite XKCD comic strip directly from R. XKCD https://xkcd.com web comic content is provided under the Creative Commons Attribution-NonCommercial 2.5 License.
Encoding: UTF-8
Imports: plyr, graphics, utils, jpeg, png, RJSONIO
Suggests: RCurl
License: GPL-2
LazyLoad: yes
RoxygenNote: 7.0.2
NeedsCompilation: no
Packaged: 2020-02-24 08:08:51 UTC; paolo
Author: Paolo Sonego ORCID iD [aut, cph, cre], Mikko Korpela [aut]
Repository: CRAN
Date/Publication: 2020-02-24 08:30:02 UTC

Display your favorite XKCD comic in R

Description

This function fetches a XKCD comic strip (randomly or by number) and displays it on screen.

Usage

getXKCD(which = "current", display = TRUE, html = FALSE, saveImg = FALSE)

Arguments

which

string: either "current" or "random"; or a number indicating the specific strip.

display

logical; TRUE (default) if you like to display the strip on the screen.

html

logical; TRUE if you like to open the XKCD web page for the selected comic in your browser: if TRUE it sets display and saveImg arguments to FALSE. Default FALSE.

saveImg

logical; TRUE if you want to save image in the current directory. Default FALSE.

Details

Old R versions may have problems accessing HTTPS URLs such as those used on the XKCD website. In case the default method of download.file fails, alternatives will be tried. For the best chance to succeed, ensure that the command line tools "wget" and "curl" as well as the "RCurl" package are installed.

Value

a list containing the following fields:

References

https://xkcd.com/license.html

Examples


library("RXKCD")
significant <- getXKCD(882, display=FALSE)


Save XKCD database info into a file in the user directory

Description

This function saves the xkcd database as a file in the user's home directory.

Usage

saveConfig()

References

https://xkcd.com/license.html


Search your favorite XKCD comic strip by title/transcript

Description

This function uses grep to inspect the title and transcript for all the occurrences of a specified string and returns a data.frame with both the number and the title of the XKCD comic strips.

Usage

searchXKCD(which = "significant")

Arguments

which

string.

Value

a data.frame containing the following fields:

References

https://xkcd.com/license.html

Examples

## Not run: 
library("RXKCD")
searchXKCD(which="significant")
searchXKCD(which="someone is wrong") 
## End(Not run)


Update the XKCD database saved in the user directory

Description

This function updates the local version of the XKCD database used by searchXKCD.

Usage

updateConfig()

References

https://xkcd.com/license.html

mirror server hosted at Truenetwork, Russian Federation.