Title: | Get XKCD Comic from R |
---|---|
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. |
Authors: | Paolo Sonego [aut, cph, cre] |
Maintainer: | Paolo Sonego <[email protected]> |
License: | GPL-2 |
Version: | 1.10.1 |
Built: | 2025-03-11 02:43:50 UTC |
Source: | https://github.com/onertipaday/rxkcd |
This function fetches a XKCD comic strip (randomly or by number) and displays it on screen.
getXKCD(which = "current", display = TRUE, html = FALSE, saveImg = FALSE)
getXKCD(which = "current", display = TRUE, html = FALSE, saveImg = FALSE)
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. |
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.
a list containing the following fields:
img URL of the XKCD comic strip image (PNG)
title Title of the XKCD comic strip
month
num Number of the XKCD comic strip
link
year Year of publication
safe_title
transcript
alt
day
news
library("RXKCD") significant <- getXKCD(882, display=FALSE)
library("RXKCD") significant <- getXKCD(882, display=FALSE)
This function saves the XKCD database as a file in the user's home directory.
saveConfig()
saveConfig()
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.
searchXKCD(which = "significant")
searchXKCD(which = "significant")
which |
string. |
a data.frame containing the following fields:
num The num of the XKCD comic strip
title The title of the XKCD comic strip
## Not run: library("RXKCD") searchXKCD(which="significant") searchXKCD(which="someone is wrong") ## End(Not run)
## Not run: library("RXKCD") searchXKCD(which="significant") searchXKCD(which="someone is wrong") ## End(Not run)
This function updates the local version of the XKCD database used by searchXKCD().
updateConfig()
updateConfig()