Gents,
I want to convert the following xts NAV series from daily to monthly.
Browse[1] navSeries
[..]
2013-01-21 1089.233
2013-01-22 1088.627
2013-01-23 1086.648
2013-01-24 1095.522
2013-01-25 1100.402
2013-01-28 1098.846
2013-01-29 1105.938
2013-01-30 1102.504
2013-01-31 1102.386
2013-02-01
Am confirming what Phil said ...
getSymbols(SPY, src=yahoo, from=2012-06-01)
[1] SPY
to.monthly(SPY) # looks correct
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
Jun 2012 129.41 136.27 127.14136.10 3644670300 134.42
Jul 2012 136.48 139.34 132.60
Actually Ulrich,
I am getting something different than you but equally incorrect.
to.monthly(SPY) # looks correct
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
Jun 2012 129.41 136.27 127.14136.10 3644670300 134.42
Jul 2012 136.48 139.34 132.60137.71
Works fine for me, even with your timezone.
Lines - 2013-01-30;100
+ 2013-01-31;101
+ 2013-02-01;102
library(xts)
Sys.setenv(TZ=Europe/Berlin)
x1 - read.zoo(con - textConnection(Lines), sep=;)
close(con)
as.POSIXct(index(x1))
[1] 2013-01-30 01:00:00 CET 2013-01-31 01:00:00 CET
[3]
Here's my session info.
I'll upgrade XTS and will let you know if I progress.
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8
Works with xts 0.9-3:
Lines - 2013-01-30;100
+ 2013-01-31;101
+ 2013-02-01;102
require(xts)
Loading required package: xts
Loading required package: zoo
Attaching package: ‘zoo’
The following object(s) are masked from ‘package:base’:
as.Date, as.Date.numeric
x1 - read.zoo(con -
Hi,
does anybody know whether 4-digit SIC codes are available in R?
Something along the lines
2834 Pharmaceutical Preparations
Thank you.
___
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
--
I'm not sure, but here's a really quick and dirty way to get it
library(XML)
x - readHTMLTable(http://www.sec.gov/info/edgar/siccodes.htm;,
stringsAsFactors=FALSE)[[4]]
colnames(x) - x[2, ]
SIC - x[-c(1:3), ]
head(SIC)
SICCode A/D Office