Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Myles McDonnell committed Oct 9, 2017
1 parent 6f6c11c commit af9ad14
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .Rproj.user/ECE30130/pcs/source-pane.pper
@@ -1,3 +1,3 @@
{
"activeTab" : 0
"activeTab" : 1
}
2 changes: 1 addition & 1 deletion .Rproj.user/ECE30130/pcs/windowlayoutstate.pper
@@ -1,7 +1,7 @@
{
"left" : {
"panelheight" : 509,
"splitterpos" : 180,
"splitterpos" : 155,
"topwindowstate" : "NORMAL",
"windowheight" : 548
},
Expand Down
4 changes: 2 additions & 2 deletions .Rproj.user/ECE30130/sources/prop/41CDFB6A
@@ -1,4 +1,4 @@
{
"cursorPosition" : "15,0",
"scrollLine" : "14"
"cursorPosition" : "58,3",
"scrollLine" : "51"
}
4 changes: 2 additions & 2 deletions .Rproj.user/ECE30130/sources/prop/7423A913
@@ -1,4 +1,4 @@
{
"cursorPosition" : "6,47",
"scrollLine" : "0"
"cursorPosition" : "16,20",
"scrollLine" : "10"
}
5 changes: 5 additions & 0 deletions .Rproj.user/ECE30130/sources/prop/INDEX
@@ -1,8 +1,13 @@
~%2FXKCDdata%2F.gitignore="F9ACD11E"
~%2FXKCDdata%2FDESCRIPTION="7423A913"
~%2FXKCDdata%2FLICENSE="44C215DB"
~%2FXKCDdata%2FR%2FgetData.R="5FB99E1F"
~%2FXKCDdata%2FR%2Fget_comic.R="EB5A94D3"
~%2FXKCDdata%2FR%2Fhello.R="9C9F3089"
~%2FXKCDdata%2FR%2Fprint_xkcd.R="C227C770"
~%2FXKCDdata%2FR%2Fxxx.R="286DB00F"
~%2FXKCDdata%2FREADME.Rmd="41CDFB6A"
~%2FXKCDdata%2Fcran-comments.md="6F94283E"
~%2FXKCDdata%2Fdata-raw%2Fdevtools-stuffs.R="206950C3"
~%2FXKCDdata%2Ftests%2Ftestthat%2Ftest-tibble_creation.R="75914FB"
~%2FtidyRSS%2FR%2Fzzz.R="EADF1422"
15 changes: 9 additions & 6 deletions .Rproj.user/shared/notebooks/paths
@@ -1,6 +1,9 @@
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/R/getData.R="88E24FC2"
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/R/get_comic.R="D13B726C"
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/R/xxx.R="3CAAFBEF"
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/cran-comments.md="DF529BF4"
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/data-raw/devtools-stuffs.R="4C5E1DAA"
C:/Users/robert.m.mcdonnell/Documents/XKCDdata/tests/testthat/test-tibble_creation.R="FB41A5FB"
/Users/robert/XKCDdata/DESCRIPTION="B5801207"
/Users/robert/XKCDdata/LICENSE="4117103D"
/Users/robert/XKCDdata/R/get_comic.R="AC484817"
/Users/robert/XKCDdata/R/print_xkcd.R="7A56E923"
/Users/robert/XKCDdata/R/xxx.R="2C89858B"
/Users/robert/XKCDdata/README.Rmd="3634689B"
/Users/robert/XKCDdata/cran-comments.md="FD1D2A7D"
/Users/robert/XKCDdata/data-raw/devtools-stuffs.R="942E3A5B"
/Users/robert/tidyRSS/R/zzz.R="28BD3D5B"
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -34,3 +34,6 @@ vignettes/*.pdf
*.utf8.md
*.knit.md
.Rproj.user

# mac files
.DS_Store
8 changes: 4 additions & 4 deletions DESCRIPTION
Expand Up @@ -13,8 +13,8 @@ Imports: httr(>= 1.3.1),
magrittr (>= 1.5),
tibble (>= 1.3.4),
dplyr (>= 0.7.4),
jsonlite(>= 1.5),
glue,
htmltools,
assertthat
jsonlite (>= 1.5),
glue (>= 1.1.1),
htmltools (>= 0.3.6),
assertthat (>= 0.2.0)
Suggests: testthat
11 changes: 2 additions & 9 deletions R/print_xkcd.R
@@ -1,18 +1,11 @@
#' Print xkcd
#'
#' Print an xkcd in your default Viewer
#'
#' @title Print XKCD
#' @description Print an XKCD comic in your default Viewer
#' @importFrom glue glue
#' @importFrom htmltools HTML html_print
#'
#' @param comic \code{integer}. Comic number.
#'
#' @examples \dontrun{print_xkcd(comic = 12)}
#'
#' @return the xkcd comic in your default Viewer
#'
#' @export

print_xkcd <- function(comic){

df <- get_comic(comic)
Expand Down
10 changes: 9 additions & 1 deletion README.Rmd
Expand Up @@ -27,7 +27,7 @@ devtools::install_github("RobertMyles/XKCDdata")

## Example:

Let's get this comic (it's number 1421):
Let's get data on this comic (it's number 1421):

![https://imgs.xkcd.com/comics/future_self.png](https://imgs.xkcd.com/comics/future_self.png)

Expand All @@ -49,3 +49,11 @@ purrr::map_df(cm, get_comic)
```

Then you could plot it XKCD-style with the [xkcd](http://xkcd.r-forge.r-project.org/) package if you wanted.

## Viewing Comics

Thanks to [Colin](https://github.com/ColinFay), you can view the comics inside your default Viewer (in the Viewer pane if you're on RStudio)! Give it a shot with:

```{r}
print_xkcd(1)
```
18 changes: 13 additions & 5 deletions README.md
Expand Up @@ -15,19 +15,18 @@ devtools::install_github("RobertMyles/XKCDdata")
Example:
--------

Let's get this comic (it's number 1421):
Let's get data on this comic (it's number 1421):

![<https://imgs.xkcd.com/comics/future_self.png>](https://imgs.xkcd.com/comics/future_self.png)

``` r
library(XKCDdata)

get_comic(comic = 1421)
#> No encoding supplied: defaulting to UTF-8.
#> # A tibble: 1 x 11
#> month num link year news safe_title
#> <chr> <int> <chr> <chr> <chr> <chr>
#> 1 9 1421 2014 Future Self
#> month num link year news safe_title
#> <chr> <int> <chr> <chr> <chr> <chr>
#> 1 9 1421 http://xkcd.com/1421 2014 Future Self
#> # ... with 5 more variables: transcript <chr>, alt <chr>, img <chr>,
#> # title <chr>, day <chr>
```
Expand All @@ -41,3 +40,12 @@ purrr::map_df(cm, get_comic)
```

Then you could plot it XKCD-style with the [xkcd](http://xkcd.r-forge.r-project.org/) package if you wanted.

Viewing Comics
--------------

Thanks to [Colin](https://github.com/ColinFay), you can view the comics inside your default Viewer (in the Viewer pane if you're on RStudio)! Give it a shot with:

``` r
print_xkcd(1)
```
9 changes: 0 additions & 9 deletions data-raw/devtools-stuffs.R

This file was deleted.

2 changes: 1 addition & 1 deletion man/get_comic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/print_xkcd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/testthat/test-tibble_creation.R
Expand Up @@ -11,6 +11,5 @@ test_that("getcomics ", {
})

test_that("printxkcd works", {
expect_message(print_xkcd(123))
expect_error(print_xkcd("abs"))
})

0 comments on commit af9ad14

Please sign in to comment.