Displaying 20 results from an estimated 8000 matches similar to: "XTS Subsetting question (noob)"
2013 May 13
1
Math problem with xts objects
Hello,
I coming across a strange problem doing math on an xts object.
If I have an xts object of stock prices (perhaps 5 minute bars of open, high, low,close) and want to do some math, the results fail.
For example:
d$close[10] - d$open[10] works perfectly
d$close[10] - d$open[9] fails. I just get an answer of "numeric(0) Index: numeric(0)".
My guess is that xts is breaking
2012 Dec 18
1
How to draw frequency domain plot with xts time series data
Hello,
I'd like to convert the below time-series data with fft or wavelet related function and plot it.
Could you let me know
1. How to convert xts data frame format to list format ?
2. How to plot fft or wavelet diagram ?
Here is the data :
> class(zc)
[1] "xts" "zoo"
> str(zc)
An ‘xts’ object from (10/15/12 09:00:00) to (10/15/12 15:15:00)
2013 Mar 16
2
Find NA in xts object
Hi to all, i'm new to R
I have an xts object.
Can i find:
a) how many NA are in my object ?
b) eventually where (in which line) they are
Thank you
2010 Nov 05
1
as.xts
hey
I am trying to turn a dataframe into xts with the function:
as.xts,
but it returns the error:
Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format
could someone give me some pointers please
the data is coming from a spreadsheet via the excel, and has 5 columns
of data (date (with the date and time), open, high, low, close) (excel
format)
ela
2011 Mar 04
4
xts POSIXct index format
Hi,
I cannot figure out how to change the index format when displaying POSIXct
objects.
Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts
object.
Think I am missing the obvious.
Cheers,
Chris
--
View this message in context: http://r.789695.n4.nabble.com/xts-POSIXct-index-format-tp3336136p3336136.html
Sent from the R help mailing list archive at Nabble.com.
2011 Jan 04
1
XTS : merge.xts seems to have problem with character vectors
Hi,
Please can you tell me what I am doing wrong. When trying to merge two xts
objects, one of which has multiple character vectors for columns...I am just
getting NAs.
> str(t)
POSIXct[1:1], format: "2011-01-04 11:45:37"
> y2 = xts(matrix(c(letters[1:10]),5), order.by=as.POSIXct(c(t + 1:5)))
> names(y2) = c(1,2)
> y2
1 2
2011-01-04 11:45:38
2017 Oct 18
1
Problem with tq_mutate_xy() from the tidyquant package
I was able to reproduce the problem with this self-contained example. Maybe
it could be reproduced with an even smaller one ...
library(tidyquant) # Loads tidyverse, tidyquant, financial pkgs, xts/zoo
library(xts)
dtV <- as.Date("2017-01-01") + 1:100
locL <- list( foo=xts(rnorm(100), order.by=dtV), bar=xts(rnorm(100),
order.by=dtV) )
fullXts <- do.call(merge,locL)
smallXts
2016 Apr 06
2
Is this a bug in quantmod::OpCl?
OpCl works on xts objects but not on quantmod.OHLC objects. Is this a bug?
Example error:
x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1
set.seed(1)
x <- zoo(matrix(runif(20, 0, 1), nrow=5, ncol=4), x.Date)
q <- as.quantmod.OHLC(x,c("Open","High","Low","Close"))
# error
OpCl(q)
#> Error in `colnames<-`(`*tmp*`, value =
2012 Mar 04
1
Store vectors as values in xts time-series object
Hi R programmers,
I have stumbled across what seems a very simple problem. My goal is to
create a xts time series object which contains vectors as values. In
other words, I try to create something like this:
2009-01-01 => c('aa', 'bb', 'dd')
...
2010-02-01 => c('mm')
I have figured out parts of separately. Here's what works (new xts
time-series with
2011 Jul 30
1
Plot.xts - how to change the x-axis labels to show weekly labels.
Dear R-users
I am new to R and struggling not to bother the list with silly questions.
I read the documentation on xts and searched for some examples over the
internet on how to use plot.xts.
The xts object is as follows
dataxts : An 'xts' object from 2010-06-27 to 2010-08-05 containing:
Data: num [1:56161, 1:14] 74 74.2 74.2 74.1 73.9 ...
Indexed by objects of
2011 Jan 11
1
Interpolate xts
Hello,
I have a xts object, I would like to fill the NA with linear
interpolated data. Can anyone please help.
> str(zz)
An ‘xts’ object from 2010-11-24 15:59:29 to 2010-11-24 16:00:00 containing:
Data: num [1:23401, 1] 312 312 312 312 312 ...
Indexed by objects of class: [POSIXct,POSIXt] TZ:
xts Attributes:
List of 2
$ src : chr "datafeed"
$ updated: POSIXct[1:1],
2012 May 29
2
Converting to XTS loses data.frame structure
Hello,
I noticed something odd when working with data frames and xts objects.
If I read in a CSV file, R creates a nice data.frame. This works well.
If I then convert to an XTS object, I see that all the values in the data are now quoted. My data is a mix of numeric and character. This is usually seen when converting a data.frame to a matrix, as R will treat all the data as the same class.
2012 Feb 16
3
Converting ts into xts and subsetting
Greetings,
I would like to subset observations in a time series using xts, after
converting from ts to xts.
X=ts(1:100, frequency=12, start=c(1976))
X2=as.xts(X)
X2["1984"]
The output:
Feb 1984 98
Mar 1984 99
Apr 1984 100
What happened to January? The index is always one month off, with
X2["1976-01"] giving me Feb 1976. Should I set the time using something
else
2012 May 22
1
Quantmod, Xts, TTR and Postgresql
Hi Everyone,
I'm currently using the latest build of R and R-Studio server (both are
amazing products)
I'm still very new to this but I came across this issue:
I'm trying to do a select from postgres and put the data into and xts
object like so:
# Libs
library('RPostgreSQL') # http://code.google.com/p/rpostgresql/
library('quantmod')
library('TTR')
2012 Jun 13
1
what does .indexDate() do - R::xts
Dear R experts,
I am learning the very useful XTS package, but cannot figure out the
purpose of some commands.
in particular, the .indexDate() command does not work as expected.
say:
x <- timeBasedSeq('2010-01-01/2010-01-02 12:00')
x <- xts(1:length(x), x)
then i can subset on date as follows:
x['2010-01-01']
however the .indexDate() command does not work as expected;
2011 Oct 03
1
xts/time-series and plot questions...
Hello,
I'm a complete newbie to R. Spent this past weekend reading The Art of R Programming, The R Cookbook, the language spec, Wikis and FAQs. I sort-of have my head around R; the dizzying selection of libraries, packages, etc? Not really. I've probably missed or failed to understand something...
I have very a simple data set. Two years (ish) of temperature data, collected and
2012 Jul 22
2
Reading many large files causes R to crash - Possible Bug in R 2.15.1 64-bit Ubuntu
I am reading several hundred files. Anywhere from 50k-400k in size. It
appears that when I read these files with R 2.15.1 the process will hang or
seg fault on the scan() call. This does not happen on R 2.14.1.
This is happening on the precise build of Ubuntu.
I have included everything, but the issue appears to be when performing the
scan in the method parseTickData.
Below is the
2018 Jan 18
0
Split charts with ggplot2, tidyquant
Hi Charlie,
I am comfortable to put the data in any way that works best. Here are two
possibilities: an xts and a data frame.
library(quantmod)
quantmod::getSymbols("SPY") # creates xts variable SPY
SPYxts <- SPY[,c("SPY.Close","SPY.Volume")]
SPYdf <- data.frame(Date=index(SPYxts),close=as.numeric(SPYxts$SPY.Close),
2017 Sep 22
2
require help
Assuming the input data.frame, DF, is of the form shown reproducibly
in the Note below, to convert the series to zoo or ts:
library(zoo)
# convert to zoo
z <- read.zoo(DF)
# convert to ts
as.ts(z) #
Note:
DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
with = c(60.3, 60.5, 60.2, 60.1, 60.7)),
2012 Oct 23
1
Filling a covariance matrix
useRs ?
I?m working with the attached data that contains one year?s worth of
sub-daily observations of flow (?Q?) and specific conductance (?SC?, a
surrogate for concentration) at a point in a stream. The R code posted
below shows the extent of data processing thus far. My goal is to create a
covariance matrix that takes on the following form:
Q1 Q2 ? Q365 SC1 SC2 ? SC365
Q1
Q2
?
Q365