Skip to content

Commit

Permalink
Merge pull request #9 from christophsax/cran-prep
Browse files Browse the repository at this point in the history
on cran now
  • Loading branch information
christophsax committed Feb 11, 2017
2 parents 34b22b6 + 1c79783 commit 8dc0220
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 38 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: seasonalview
Type: Package
Title: Graphical User Interface for Seasonal Adjustment
Version: 0.1.5
Date: 2016-12-17
Version: 0.2
Date: 2017-02-11
Author: Christoph Sax
Maintainer: Christoph Sax <christoph.sax@gmail.com>
Description: A graphical user interface to the 'seasonal' package and
Description: A graphical user interface to the 'seasonal' package and
'X-13ARIMA-SEATS', the U.S. Census Bureau's seasonal adjustment software.
Unifies the code base of <http://www.seasonal.website> and the GUI in the
Unifies the code base of <http://www.seasonal.website> and the GUI in the
'seasonal' package.
Depends:
R (>= 3.0.0),
Expand All @@ -16,11 +16,12 @@ Imports:
shinydashboard (>= 0.5.3),
shiny (>= 0.14),
dygraphs (>= 1.1.1.3),
htmlwidgets,
openxlsx,
xtable,
xts,
zoo
License: GPL-3
URL: http://www.seasonal.website
BugReports: https://github.com/christophsax/seasonalview
RoxygenNote: 5.0.1
RoxygenNote: 6.0.0
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ importFrom(dygraphs,dyAnnotation)
importFrom(dygraphs,dyLegend)
importFrom(dygraphs,dyOptions)
importFrom(dygraphs,dygraph)
importFrom(htmlwidgets,createWidget)
importFrom(htmlwidgets,sizingPolicy)
importFrom(openxlsx,read.xlsx)
importFrom(openxlsx,write.xlsx)
importFrom(seasonal,outlier)
Expand All @@ -16,13 +18,18 @@ importFrom(stats,BIC)
importFrom(stats,Box.test)
importFrom(stats,coef)
importFrom(stats,cycle)
importFrom(stats,end)
importFrom(stats,frequency)
importFrom(stats,is.ts)
importFrom(stats,lag)
importFrom(stats,median)
importFrom(stats,nobs)
importFrom(stats,shapiro.test)
importFrom(stats,start)
importFrom(stats,symnum)
importFrom(stats,time)
importFrom(stats,ts)
importFrom(stats,tsp)
importFrom(utils,data)
importFrom(utils,download.file)
importFrom(utils,read.csv)
Expand Down
6 changes: 3 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
0.1.5 2016-??-??
0.2 2017-02-11
--------------------------------------------------------------------------------

Under the hood:

- better way to pass stuff to shiny app, using shinyOptions().
- uses import.spc() from seasonal 1.4 for X13 spc parsing.
- uses import.spc() from seasonal 1.4 for X-13 spc parsing.
- workaround functions to properly import xts, which depends on zoo functions,
so that seasonalview can be imported from other packages, such as seasonal.
This will be reworked once a new version of xts is on CRAN.
Expand All @@ -16,7 +16,7 @@ Bug fixes:



0.1.3 2016-12-14
0.1.3 2016-12-14
--------------------------------------------------------------------------------

Initial CRAN Version
Expand Down
18 changes: 13 additions & 5 deletions R/importable-xts.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
# (the underlying problem is that the xts package DEPENDS on zoo, and all the
# following packages have to depend as well. The 'dygraphs' package circumvents
# this problem by exporting the functions from zoo, but this makes the dygraph
# package non- exportable.)
# package non-exportable.)


#' @importFrom stats frequency tsp median end start
#' @importFrom htmlwidgets createWidget sizingPolicy
dygraph_xtsimp <- function (data, main = NULL, xlab = NULL, ylab = NULL, periodicity = NULL,
group = NULL, elementId = NULL, width = NULL, height = NULL)
{
Expand All @@ -28,7 +31,12 @@ dygraph_xtsimp <- function (data, main = NULL, xlab = NULL, ylab = NULL, periodi
if (format == "date") {
if (is.null(periodicity)) {
if (nrow(data) < 2) {
periodicity <- defaultPeriodicity(data)
# content of: dygraphs:::defaultPeriodicity
periodicity <- structure(list(difftime = structure(0, units = "secs",
class = "difftime"), frequency = 0, start = start(data),
end = end(data), units = "secs", scale = "seconds", label = "second"),
class = "periodicity")
# periodicity <- defaultPeriodicity(data)
}
else {
periodicity <- xts::periodicity(data)
Expand Down Expand Up @@ -130,7 +138,8 @@ time_xtsimp <- function (x, ...){
return(zoo::as.yearmon(.POSIXct(xts::.index(x), tz = attr(xts::.index(x), "tzone"))))
if (xts::indexClass(x) == "yearqtr")
return(zoo::as.yearqtr(.POSIXct(xts::.index(x), tz = attr(xts::.index(x), "tzone"))))
xts:::time.xts(x)
# xts:::time.xts(x)
time(x)
}


Expand All @@ -145,8 +154,7 @@ as_xts_xtsimp <- function(x) {
dateFormat <- ifelse(max(time(x)) > 86400, "POSIXct",
"Date")
order.by <- do.call(paste("as", dateFormat, sep = "."),
list(as.numeric(time(x)), origin = "1970-01-01",
...))
list(as.numeric(time(x)), origin = "1970-01-01"))
} else {
mo <- ifelse(length(mo) < 1, 1, floor(mo * 12) +
1)
Expand Down
2 changes: 1 addition & 1 deletion R/seasonalview-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' \url{http://www.seasonal.website} with the GUI in the \pkg{seasonal} package.
#'
#' Have a look at the README for usage examples:
#' \url{https://cran.r-project.org/web/packages/seasonalview/README.html}
#' \url{https://CRAN.R-project.org/package=seasonalview/README.html}
#'
#' @name seasonalview-package
#' @aliases seasonalview
Expand Down
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,19 @@ interfaces from the [seasonal](https://cran.r-project.org/package=seasonal) and
[x13story](https://github.com/christophsax/x13story) packages and the online
adjustment tool on [www.seasonal.website](http://www.seasonal.website).

These interfaces have grown over time and have become difficult to maintain. The
**seasonalview** package is an attempt to unify their code base. It takes the
best from each interface, and makes it available to the others.

To install from CRAN, use:

install.packages("seasonalview")


To install the development version from GitHub, use:

devtools::install_github("christophsax/seasonalview")


### Seasonal

The main function of the package is the `view` function, which works similar as
the current `inspect` function in
[seasonal](https://cran.r-project.org/package=seasonal). Here is an example:
The main function of the package is the `view` function, which works like the
depreciated `inspect` function in
[seasonal](https://cran.r-project.org/package=seasonal) (which it replaces).
[seasonalview](https://cran.r-project.org/package=seasonalview) is imported by [seasonal](https://cran.r-project.org/package=seasonal), so loading is not necessary:

library(seasonalview) # this will also attach seasonal
library(seasonal)
m <- seas(AirPassengers)
view(m)

Expand All @@ -38,10 +30,12 @@ the current `inspect` function in

If you have the [x13story](https://github.com/christophsax/x13story) package
installed, you can call the function with the `story` argument. This will render
an R Markdown document and produce a *story* on seasonal adjustment that can be
manipulated interactively.
an
[R Markdown document](https://raw.githubusercontent.com/christophsax/x13story/master/inst/stories/x11.Rmd)
and produce a *story* on seasonal adjustment that can be manipulated
interactively.

view(story = system.file(package = "x13story", "stories", "x11.Rmd"))
view(story = "https://raw.githubusercontent.com/christophsax/x13story/master/inst/stories/x11.Rmd")

<img src="https://raw.githubusercontent.com/christophsax/seasonalview/master/img/x13story.png" width="70%"/>

Expand All @@ -53,6 +47,7 @@ or on a server. While itself not very useful, the `standalone` function
showcases how a local version of
[www.seasonal.website](http://www.seasonal.website) would look like:

library(seasonalview)
standalone()

<img src="https://raw.githubusercontent.com/christophsax/seasonalview/master/img/standalone.png" width="70%"/>
Expand Down
11 changes: 5 additions & 6 deletions man/seasonalview-package.Rd

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

1 change: 0 additions & 1 deletion man/standalone.Rd

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

1 change: 0 additions & 1 deletion man/view.Rd

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

0 comments on commit 8dc0220

Please sign in to comment.