-
Notifications
You must be signed in to change notification settings - Fork 1
/
NAMESPACE
263 lines (233 loc) · 8.38 KB
/
NAMESPACE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
################################################
## import name space
################################################
## MM: Importing all is almost surely a waste [FIXME!]
import("methods") # , show
importFrom("grDevices", col2rgb, rgb , xy.coords)
if(packageVersion("timeDate") <= '4032.109')
importFrom("timeDate", frequency)
if(packageVersion("timeDate") > '4032.109')
importFrom("stats", frequency)
importFrom("stats",
approx, approxfun, spline, splinefun,
var, cor, dist, hclust, qt, rnorm, runif, runmed,
ts, is.mts, deltat,
## for these, we provide methods:
start, end, time, window, lag, filter,
aggregate, as.ts,
median, quantile, na.contiguous, na.omit
)
importFrom("graphics", # Note: lines, plot, points imported from timeDate
axTicks, axis, axis.POSIXct,
box, grid, layout, mtext, par,
plot.default, plot.new, plot.window,
segments, text, title
)
importFrom("utils",
head.matrix, tail.matrix, read.table,
.DollarNames, # as we provide an S3 method
## provide methods for these :
head, tail, str
)
importFrom("timeDate",
abline, # the S4 generic from here, not "graphics" (graphics::abline is not generic)
##--- For these we provide and export methods :
plot, # base
lines, points, # graphics
isDaily, isMonthly, isQuarterly, isRegular,
align,
##---- end of generics for which we define/export methods
getRmetricsOptions, setRmetricsOptions,
finCenter, "finCenter<-",
as.timeDate, atoms, dayOfWeek, isWeekday,
timeCalendar, timeDate, timeSequence,
timeFirstDayInMonth, timeFirstDayInQuarter,
timeLastDayInMonth, timeLastDayInQuarter,
kurtosis, skewness
)
importMethodsFrom("timeDate",
"+", "-", "Ops", "["
)
################################################
## S3 methods
################################################
S3method(".DollarNames", "timeSeries")
S3method("aggregate", "timeSeries")
S3method("as.data.frame", "timeSeries")
S3method("as.list", "timeSeries")
S3method("as.matrix", "timeSeries")
S3method("as.timeSeries", character)
S3method("as.timeSeries", data.frame)
S3method("as.timeSeries", default)
S3method("as.timeSeries", ts)
S3method("as.timeSeries", zoo)
S3method("as.ts", "timeSeries")
S3method("cbind", "timeSeries")
S3method("cumulated", default)
# S3method("cut", "timeSeries") # timeSeries method was removed on 2023-05-26
S3method("diff", "timeSeries")
S3method("end", "timeSeries")
S3method("getUnits", default)
S3method("head", "timeSeries")
S3method("lag", "timeSeries")
S3method("lines", "timeSeries")
S3method("median", "timeSeries")
S3method("merge", "timeSeries")
S3method("na.contiguous", "timeSeries")
S3method("na.omit", "timeSeries")
S3method("plot", "timeSeries")
S3method("points", "timeSeries")
S3method("pretty", "timeSeries")
S3method("print", timeSeries)
S3method("print", timeSeries_summary)
S3method("rbind", "timeSeries")
S3method("rev", "timeSeries")
S3method("scale", "timeSeries")
S3method("sort", "timeSeries")
S3method("start", "timeSeries")
S3method("summary", "timeSeries")
S3method("str", "timeSeries")
S3method("tail", "timeSeries")
S3method("window", "timeSeries")
S3method("time", "timeSeries")
S3method("frequency", "timeSeries")
S3method("is.unsorted", "timeSeries")
S3method("time<-", "timeSeries")
S3method("time<-", default)
if(getRversion() >= "3.6.0") { # GNB
## we ensure that when zoo is loaded zoo::`time<-` gets the 'timeSeries'
## method. This works nicely, if 'zoo' is attached after 'timeSeries' (or
## if 'timeSeries' is loaded but not attached). It may seem that if
## 'timeSeries' is attached after 'zoo', zoo::`time<-` will be masked, so
## 'time(x) <- value' will see only the methods for the timeSeries version
## of 'time<-'. But this is not a problem since the default method for
## timeSeries::`time<-` calls zoo::`time<-`
S3method(zoo::`time<-`, "timeSeries")
S3method(zoo::coredata, "timeSeries")
S3method(zoo::'coredata<-', "timeSeries")
}
################################################
## S4 classes
################################################
exportClasses("index_timeSeries",
"timeSeries",
"time_timeSeries"
)
exportMethods(
"$", "$<-", "+", "-", "Ops", "[",
## from timeDate
"align",
"finCenter", "finCenter<-",
"isDaily", "isMonthly", "isQuarterly", "isRegular",
## from methods
"cbind2", "rbind2",
"coerce",
"getDataPart", "setDataPart", # not generic in methods
"initialize",
"show",
## primitive R functions (internally S3 and S4 generic)
"cummax", "cummin", "cumprod", "cumsum",
"dim", "dim<-",
"dimnames", "dimnames<-",
"names", "names<-",
## stats
## "aggregate",
## "as.ts",
"filter", # not generic in stats; let it stay S4 here
## graphics
## "lines", "points",
## from base
"apply", # not generic in base
"as.data.frame", "as.list", "as.matrix",
"attach", # not generic in base
"colMeans", "colSums", # not generic in base
"colnames", "colnames<-", "rownames", "rownames<-", # not generic in base
"comment", "comment<-", # not generic in base
# "cut", # timeSeries method was removed on 2023-05-26
"is.unsorted", # internal generic in base (but seemingly only S3, not S4)
"merge", # the S4 methods are for x and y, so S4 is essential
"plot",
"rank", # not generic in base
"sample", # not generic in base
"t"
)
################################################
## functions
################################################
export(
".colorwheelPalette", # used in the vignette
"alignDailySeries",
"applySeries",
"as.timeSeries",
"colCummaxs", "colCummins", "colCumprods", "colCumreturns", "colCumsums",
"colKurtosis", "colMaxs", "colMins", "colProds",
"colQuantiles", "colSds", "colSkewness", "colStats", "colVars",
"coredata.timeSeries", "coredata<-.timeSeries",
"countMonthlyRecords",
"cumulated",
"daily2monthly", "daily2weekly",
"description",
"drawdowns", "drawdownsStats",
"dummyDailySeries", "dummyMonthlySeries",
"durations",
"endOfPeriodBenchmarks", "endOfPeriodSeries", "endOfPeriodStats",
"fapply",
"getAttributes",
"getFinCenter",
"getReturns", # several uses in the tests in 'fTrading'
# I corrected the devel version of 'fTrading'.
# TODO: remove when fTrading is updated on CRAN.
"getTime",
"getUnits", "getUnits.default",
"hclustColnames",
"index2wealth",
"interpNA",
"is.signalSeries", "is.timeSeries",
"isMultivariate", "isUnivariate",
"midquotes",
"orderColnames",
"orderStatistics",
"outlier",
"pcaColnames",
"readSeries",
"removeNA",
"returns", "returns0",
"rollDailySeries",
"rollMax", "rollMean", "rollMedian", "rollMin",
"rollMonthlySeries", "rollMonthlyWindows", "rollStats",
"rowCumsums",
"runlengths",
"sampleColnames",
"series", "series<-",
"setAttributes<-",
"setFinCenter<-", "setTime<-", "setUnits<-",
"smoothLowess", "smoothSpline", "smoothSupsmu",
"sortColnames",
"splits", "spreads",
"statsColnames",
"substituteNA",
"time",
"time<-",
"timeSeries",
"turns", "turnsStats",
"head", # 2024-01-05 GNB: were in exportMethods but no longer S4 generic
"tail",
"str",
"start",
"end",
"median",
"quantile",
"na.contiguous",
## "sort", # from 'base', no need to export
## "rev",
## "print",
## "diff",
## "is.na", # primitive
## "frequency",
"aggregate", "as.ts", # stats, reexport
## graphics
"lines", "points", # graphics, reexport
"na.omit",
"lag",
"window"
)