Permalink
Browse files

Dates are date objects now, #5

  • Loading branch information...
1 parent 446aadb commit 8c239fd240ae770e644148dde0d382983d7bc87d @gaborcsardi gaborcsardi committed Mar 11, 2015
Showing with 4 additions and 4 deletions.
  1. +3 −3 R/cranlogs.R
  2. +1 −1 man/cran_downloads.Rd
View
@@ -23,7 +23,7 @@ url <- "http://cranlogs.r-pkg.org/downloads/daily/"
#' @return A data frame with columns:
#' \item \code{package} The package. This column is missing if
#' all packages were queried.
-#' \item \code{date} Day of the downloads.
+#' \item \code{date} Day of the downloads, it is a Date object.
#' \item \code{count} Download count.
#'
#' @export
@@ -76,7 +76,7 @@ to_df <- function(res) {
if (length(res) == 1 && is.null(res[[1]]$package)) {
data.frame(
stringsAsFactors = FALSE,
- date = sapply(res[[1]]$downloads, "[[", "day"),
+ date = as.Date(sapply(res[[1]]$downloads, "[[", "day")),
count = sapply(res[[1]]$downloads, "[[", "downloads")
)
@@ -87,7 +87,7 @@ to_df <- function(res) {
data.frame(
stringsAsFactors = FALSE,
package = x$package,
- date = sapply(x$downloads, "[[", "day"),
+ date = as.Date(sapply(x$downloads, "[[", "day")),
count = sapply(x$downloads, "[[", "downloads")
)
})
View
@@ -23,7 +23,7 @@ If this is given, then \code{from} and \code{to} are ignored.}
A data frame with columns:
\item \code{package} The package. This column is missing if
all packages were queried.
- \item \code{date} Day of the downloads.
+ \item \code{date} Day of the downloads, it is a Date object.
\item \code{count} Download count.
}
\description{

0 comments on commit 8c239fd

Please sign in to comment.