Skip to content

Commit

Permalink
Register missing S3 methods and update signatures
Browse files Browse the repository at this point in the history
With R-devel (83995-ish) `R CMD check` notes these S3 methods are not
registered. It also notes that the signatures for as.POSIXct.tis() and
str.replot_xts() do not match the respective generics.

It also thinks time.frequency() is a S3 method because time() is a
generic. The function isn't exported, so renaming won't break any
external code.

See #398.
  • Loading branch information
joshuaulrich committed Mar 16, 2023
1 parent dc12b40 commit 7a52530
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ S3method(lines,xts)
S3method(points,xts)
S3method(print, replot_xts)
S3method(plot, replot_xts)
S3method(str, replot_xts)

#export(lines.xts)
#S3method(lines,xts)
Expand Down Expand Up @@ -240,6 +241,7 @@ S3method('tclass<-', default)
S3method(tclass,xts)
S3method('tclass<-',xts)

S3method(tformat,default)
S3method(tformat,xts)
S3method('tformat<-',xts)

Expand Down Expand Up @@ -324,4 +326,8 @@ S3method(as.xts,yearqtr)
S3method(as.xts,timeDate)
## currently unexported functions that _may_ be exported at some point

# tis package methods
S3method(as.POSIXct, tis)
S3method(as.xts, tis)

#export(startof,endof,firstof,lastof)
2 changes: 1 addition & 1 deletion R/periodicity.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

time.frequency <- function(x) {
time_frequency <- function(x) {
x <- gsub(":|/|-| ", "", x)
nc <- nchar(x)
if(nc < 4) stop("unrecognizable time.scale")
Expand Down
4 changes: 2 additions & 2 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ new.replot_xts <- function(frame=1,asp=1,xlim=c(1,10),ylim=list(structure(c(1,10
return(replot_env)
}

str.replot_xts <- function(x, ...) {
print(str(unclass(x)))
str.replot_xts <- function(object, ...) {
print(str(unclass(object)))
}

print.replot_xts <- function(x, ...) plot(x,...)
Expand Down
3 changes: 2 additions & 1 deletion R/tis.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

# functions to support package:tis

as.POSIXct.tis <- function(x, offset=1, tz="", ...)
as.POSIXct.tis <- function(x, tz="", ..., offset=1) {
as.numeric(.POSIXct(x,tz))
}

as.xts.tis <- function(x, offset=1, ...)
{
Expand Down

0 comments on commit 7a52530

Please sign in to comment.