I want to do a project with quantmod and compare Stock charts. As these Charts usually have different absolute values I wanted to normalize by dividing through the first value.
loading data
getSymbols(Symbols = "^IXIC", verbose = FALSE, warnings = TRUE, src = "yahoo", symbol.lookup = TRUE, auto.assign = getOption('getSymbols.auto.assign',TRUE))
IXIC_test1 <- IXIC/2
works well, as I got a time-series again
> head(IXIC_test1)
IXIC.Open IXIC.High IXIC.Low IXIC.Close IXIC.Volume IXIC.Adjusted
2007-01-03 1214.860 1227.310 1197.330 1211.580 1217640000 1211.580
2007-01-04 1211.910 1230.255 1206.875 1226.715 1052105000 1226.715
2007-01-05 1222.535 1222.535 1210.295 1217.125 1030180000 1217.125
2007-01-08 1217.625 1222.815 1210.565 1219.100 952810000 1219.100
2007-01-09 1221.630 1224.935 1211.780 1221.915 1072080000 1221.915
2007-01-10 1217.020 1230.670 1213.950 1229.665 1137105000 1229.665
But, when I try to use
IXIC_Norm <- IXIC/first(IXIC)
I get only one line
> head(IXIC_Norm)
IXIC.Open IXIC.High IXIC.Low IXIC.Close IXIC.Volume IXIC.Adjusted
2007-01-03 1 1 1 1 1 1
Could somebody please tell me, why this isn't gonna work?