Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:xts获取xts时间序列对象中某一行的年或月_R_Xts - Fatal编程技术网

R:xts获取xts时间序列对象中某一行的年或月

R:xts获取xts时间序列对象中某一行的年或月,r,xts,R,Xts,例如,如何以字符串形式获取xts时间序列对象中第一个或最后一个条目的年份?在这个AAPL时间序列的例子中 require(quantmod) getSymbols("AAPL") 首次入境的年份 format(index(first(AAPL)),"%Y") 最后一次进入的年份 format(index(last(AAPL)),"%Y")

例如,如何以字符串形式获取xts时间序列对象中第一个或最后一个条目的年份?在这个AAPL时间序列的例子中

require(quantmod)
getSymbols("AAPL")

首次入境的年份

format(index(first(AAPL)),"%Y")
最后一次进入的年份

format(index(last(AAPL)),"%Y")