xts

Automatically plot (and save) list of xts objects

北战南征 提交于 2019-12-24 01:44:09
问题 I have a long list of xts objects and I'd like to automatically plot and save them to a folder (because it takes a v long time to do manually with >500 plots). The tricky part seems to be to apply functions to lists of xts objects. For example, getting a generalized naming method for the list elements based on its date (each xts object in the list is a unique day), and plotting each object and saving them to a file path with its own name. The data can be found in a previous post here. Each

R: how to vapply across rows for xts object?

感情迁移 提交于 2019-12-23 19:44:44
问题 I have the following xts object. x <- structure(c(30440.5, 30441, 30441.5, 30441.5, 30441, 30439.5, 30440.5, 30441, 30441.5, NA, NA, 30439.5, NA, NA, NA, 30441.5, 30441, NA), .indexTZ = "", class = c("xts", "zoo"), .indexCLASS = c("POSIXct", "POSIXt"), tclass = c("POSIXct", "POSIXt"), tzone = "", index = structure(c(1519866931.1185, 1519866931.1255, 1519866931.1255, 1519866931.1905, 1519866931.1905, 1519866931.1915), tzone = "", tclass = c("POSIXct", "POSIXt")), .indexFormat = "%Y-%m-%d %H:%M

How can I alter a time series (XTS or ZOO) in R?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 07:28:33
问题 I am new to stackoverflow and fairly new to R but have searched long and hard and cannot find an answer to the following question. I have a number of data files that are temperature against a time series. I am importing the CSV as a ZOO object then converting to XTS. A correct file looks like this, with readings on the hour and the half hour: >head(master1) S_1 2010-03-03 00:00:00 2.8520 2010-03-03 00:30:00 2.6945 2010-03-03 01:00:00 2.5685 2010-03-03 01:30:00 2.3800 2010-03-03 02:00:00 2

Errors installing RForge version of xts package for R on OSX

我的未来我决定 提交于 2019-12-23 05:51:09
问题 The latest version of xts on CRAN is 0.7-5. But I'd like to try out the blotter package, for which xts >= 0.7.6.17 is required. To get this latest version, I first I downloaded the .tgz file from RForge and tried: [Downloads]$ R CMD INSTALL xts_0.7-6.17.tgz WARNING: ignoring environment value of R_HOME * installing to library ‘/Library/Frameworks/R.framework/Resources/library’ * installing *binary* package ‘xts’ ... * DONE (xts) After launching R console, I typed require(xts) and got this: >

Merging XTS objects [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-23 05:27:24
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I have 5 XTS objects. Each containing an individual variable returns (various asset classes, e.g. stocks, bonds, hedge funds, etc...) The problem I am having is that the date sequence for each object are not exact. Some dates are missing for some of the individual objects. Generally, the data are

Merging XTS objects [closed]

穿精又带淫゛_ 提交于 2019-12-23 05:27:23
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I have 5 XTS objects. Each containing an individual variable returns (various asset classes, e.g. stocks, bonds, hedge funds, etc...) The problem I am having is that the date sequence for each object are not exact. Some dates are missing for some of the individual objects. Generally, the data are

How can i convert a dataframe with a factor column to a xts object?

廉价感情. 提交于 2019-12-22 17:55:05
问题 I have a csv file and when i use this command SOLK<-read.table('Book1.csv',header=TRUE,sep=';') I get this output > SOLK Time Close Volume 1 10:27:03,6 0,99 1000 2 10:32:58,4 0,98 100 3 10:34:16,9 0,98 600 4 10:35:46,0 0,97 500 5 10:35:50,6 0,96 50 6 10:35:50,6 0,96 1000 7 10:36:10,3 0,95 40 8 10:36:10,3 0,95 100 9 10:36:10,4 0,95 500 10 10:36:10,4 0,95 100 . . . . . . . . . . . . 285 17:09:44,0 0,96 404 Here is the result of dput(SOLK[1:10,]) : > dput(SOLK[1:10,]) structure(list(Time =

plotting xts objects - passsing values for lwd and col parameters creating errors

家住魔仙堡 提交于 2019-12-22 10:49:37
问题 Whenever I try to plot my xts object with values passed for parameter col and lwd, it returns an error saying that the parameter col (and then lwd if I comment out col) matched multiple values. Here is what the function looks like - data is an xts object plot(data, lwd=2, col="red") Installing xtsExtra seems to solve the problem, but I don't understand why. 回答1: xts:::plot.xts specifies several parameters when constructing the axes ( col , lwd , las , and mgp ), but it also passes ... to the

Text not appearing on XTS plot

孤街醉人 提交于 2019-12-22 10:24:34
问题 I'm having trouble adding some text to an plot of time series data in R using xts . I've produced a simple example of the problem. My text() command seems to do nothing, whereas I can add a points to the plot. I've tried to keep the code simple by using defaults where possible require(quantmod) # fetch the data and plot it using default options getSymbols('MKS.L') plot(MKS.L$MKS.L.Close) # try to add text - doesn't appear text(as.Date('2012-01-01'),y=500,"wobble", cex=4) # add a point - this

R quantmod:getFinancials

泪湿孤枕 提交于 2019-12-22 09:56:00
问题 I'm trying to import the financials statements of all the companies listed on the NYSE whose market cap is in greater than the first quartile of the sample. Here is my code : require(TTR) require(quantmod) data.init="2013/01/01" start.date <- as.numeric(gsub("/", "",data.init)) nyse.symbols <- stockSymbols("NYSE")[,-c(3,5)] nyse.symbols <- na.omit(nyse.symbols[which(nyse.symbols[,"MarketCap"]>0),]) ######## Selection Criteria # Filter 1 : stock mkt cap > 1st quartile --> remove the less