Ответ 1
Короткий ответ заключается в том, что вы ищете функцию xts:::align.time.xts
.
Более длинный ответ заключается в том, что вы можете найти, какие методы существуют для align.time
, вызывая methods
:
> methods(align.time)
[1] align.time.POSIXct* align.time.POSIXlt* align.time.xts*
Non-visible functions are asterisked
Это говорит вам, что существует метод align.time.xts
, который не экспортируется из пространства имен. На данный момент вы можете догадаться, что его можно найти в пакете xts
, но вы можете подтвердить, что с помощью getAnywhere
:
> getAnywhere("align.time.xts")
A single object matching 'align.time.xts' was found
It was found in the following places
registered S3 method for align.time from namespace xts
namespace:xts
with value
function (x, n = 60, ...)
{
if (n <= 0)
stop("'n' must be positive")
.xts(x, .index(x) + (n - .index(x)%%n), tzone = indexTZ(x),
tclass = indexClass(x))
}
<environment: namespace:xts>
Вы можете, конечно, напрямую прочитать источник, но поскольку функция не экспортируется, вам нужно использовать package:::function
(т.е. три двоеточия):
> xts:::align.time.xts
function (x, n = 60, ...)
{
if (n <= 0)
stop("'n' must be positive")
.xts(x, .index(x) + (n - .index(x)%%n), tzone = indexTZ(x),
tclass = indexClass(x))
}
<environment: namespace:xts>