Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix #99 importFrom for ggplot2, ggplot2 moved from depends to imports
Browse files Browse the repository at this point in the history
bumped patch version
  • Loading branch information
sckott committed Feb 15, 2016
1 parent 689e580 commit 658b146
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: A programmatic interface to the 'SOLR' based
articles, making plots, doing 'faceted' searches,
'highlight' searches, and viewing results of 'highlighted'
searches in a browser.
Version: 0.5.4.9590
Version: 0.5.5.9000
License: MIT + file LICENSE
Authors@R: c(
person("Scott", "Chamberlain", role = c("aut", "cre"), email = "[email protected]"),
Expand All @@ -18,12 +18,11 @@ URL: https://github.com/ropensci/rplos
BugReports: https://github.com/ropensci/rplos/issues
LazyData: true
VignetteBuilder: knitr
Depends:
ggplot2
Imports:
methods,
utils,
stats,
ggplot2,
httr (>= 1.0.0),
jsonlite,
dplyr,
Expand Down
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ export(plosviews)
export(plosword)
export(plot_throughtime)
export(searchplos)
import(ggplot2)
importFrom(dplyr,left_join)
importFrom(dplyr,rbind_all)
importFrom(ggplot2,aes)
importFrom(ggplot2,geom_bar)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,labs)
importFrom(ggplot2,scale_colour_brewer)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_grey)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,stop_for_status)
Expand Down
1 change: 1 addition & 0 deletions R/plosword.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#' out[[2]] # results in a bar plot
#'
#' # Pass in curl options
#' library("httr")
#' plosword('Helianthus', config=verbose())
#' }

Expand Down
17 changes: 8 additions & 9 deletions R/plot_throughtime.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@
#' plot_throughtime(list('drosophila','flower','dolphin','cell','cloud'), 100)
#' }

plot_throughtime <- function(terms, limit = NA, ...)
{
plot_throughtime <- function(terms, limit = NA, ...) {
## avoid false positive 'unreferenced variable' warnings
year=month=dateplot=V1=value=variable=NULL
temp <- lapply(terms, timesearch, limit=limit, ...)
ij <- function(...) left_join(..., by=c("year", "month"))
year = month = dateplot = V1 = value = variable = NULL
temp <- lapply(terms, timesearch, limit = limit, ...)
ij <- function(...) left_join(..., by = c("year", "month"))
df <- setNames(Reduce(ij, temp), c("year", "month", terms))
df$dateplot <- as.Date(paste(df$month, "1",
substring(df$year, 3, 4), sep="/"), "%m/%d/%y")
substring(df$year, 3, 4), sep = "/"), "%m/%d/%y")
dfm <- melt(df[, -c(1:2)], id.vars = "dateplot")
dfm$value <- as.numeric(dfm$value)
pp <- ggplot(dfm, aes(x = dateplot, y = value, group = variable, colour = variable)) +
geom_line(size = 2) +
scale_colour_brewer(palette = "Blues") +
scale_colour_brewer(palette = "Dark2") +
labs(x = "", y = "Number of articles matching search term(s)\n",
title = paste("PLoS search of", paste(as.character(terms), collapse=","), "using the rplos package")) +
title = paste("PLoS search of", paste(as.character(terms), collapse = ","), "using the rplos package")) +
theme(legend.position = c(0.35, 0.8))
return(pp)
}

timesearch <- function(terms, limit, ...){
month=NULL
month <- NULL
args <- ploscompact(list(q = terms, fl = "publication_date", wt = "json", rows = limit))
tt <- GET(pbase(), query = args, ...)
stop_for_status(tt)
Expand Down
2 changes: 1 addition & 1 deletion R/rplos-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' @importFrom whisker whisker.render
#' @importFrom solr solr_highlight solr_facet
#' @importFrom lubridate now
#' @import ggplot2
#' @importFrom ggplot2 ggplot aes geom_bar theme_grey geom_line scale_colour_brewer labs theme
#' @docType package
#' @name rplos
#' @aliases rplos rplos-package
Expand Down
1 change: 1 addition & 0 deletions man/plosword.Rd

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

0 comments on commit 658b146

Please sign in to comment.