knitr::opts_chunk$set( collapse = TRUE, comment = "##", fig.path = "README-" )
options("width"=110) tmp <- packageDescription( basename(getwd()) )
cat("#", tmp$Title)
filelist.R <- list.files("R", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE) filelist.tests <- list.files("tests", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE) filelist.cpp <- list.files("src", recursive = TRUE, pattern="\\.cpp$", ignore.case = TRUE, full.names = TRUE) lines.R <- unlist(lapply(filelist.R, readLines)) lines.tests <- unlist(lapply(filelist.tests, readLines)) lines.cpp <- unlist(lapply(filelist.cpp, readLines)) length.R <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.R, value = TRUE, invert = TRUE)) length.tests <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.tests, value = TRUE, invert = TRUE)) length.cpp <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.cpp, value = TRUE, invert = TRUE))
Status
lines of R code: r length.R
, lines of test code: r length.tests
Youtube video of Hamburg UseR Meetup presentation
https://youtu.be/56qrwa4bzK8
Development version
source_files <- grep( "/R/|/src/|/tests/", list.files(recursive = TRUE, full.names = TRUE), value = TRUE ) last_change <- as.character( format(max(file.info(source_files)$mtime), tz="UTC") )
cat(tmp$Version) cat(" - ") cat(stringr::str_replace(last_change, " ", " / "))
Description
cat(tmp$Description)
License
cat(tmp$License, "<br>") cat(tmp$Author)
Citation
citation("crossword.r")
BibTex for citing
toBibtex(citation("crossword.r"))
Installation
Stable version from CRAN:
install.packages("crossword.r")
Latest development version from Github:
devtools::install_github("petermeissner/crossword.r")
Help wanted
# load the library library(crossword.r) # set seed for pseudo random number generator set.seed(123) # create a new 4 by 4 crossword cw <- Crossword$new(rows = 10, columns = 10) cw_words <- cw_wordlist_animal_en[sample(nrow(cw_wordlist_animal_en)),] cw$add_words( words = cw_words$words, clues = cw_words$clues )
# use the default print method to have a look
cw
# access to letters on the grid cw$letters # access to words placed on the grid, their co-ordinates and so on cw$words
# get some statistics cw$density()
# export to JSON cw$to_json(pretty=TRUE)
# export to JSON cat(paste(substring(cw$to_json(pretty=TRUE),1,765), "}\n\n[...]"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.