Hi all R gurus,

I'm trying to produce simple returns on a series of market prices but am
receiving zeros, even when using the formula directly. The timeSeries
function "returns" is the only method, of the methods that I've tried,
that works for me. My preference is to use PerformanceAnalytics
"Return.calculate" to preserve continuity.

library(quantmod)
library(PerformanceAnalytics)
library(timeSeries)

getSymbols("SPY", from = "2012-02-21")

SPY/SPY[-nrow(SPY), ] -1  # returns all zeros

           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2012-02-21        0        0       0         0          0            0
2012-02-22        0        0       0         0          0            0
2012-02-23        0        0       0         0          0            0
2012-02-24        0        0       0         0          0            0
2012-02-27        0        0       0         0          0            0
2012-02-28        0        0       0         0          0            0
2012-02-29        0        0       0         0          0            0
2012-03-01        0        0       0         0          0            0
2012-03-02        0        0       0         0          0            0

Return.calculate(SPY, method="simple")  # returns all zeros as well

           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2012-02-21        0        0       0         0          0            0
2012-02-22        0        0       0         0          0            0
2012-02-23        0        0       0         0          0            0
2012-02-24        0        0       0         0          0            0
2012-02-27        0        0       0         0          0            0
2012-02-28        0        0       0         0          0            0
2012-02-29        0        0       0         0          0            0
2012-03-01        0        0       0         0          0            0
2012-03-02        0        0       0         0          0            0

returns(SPY, method = "discrete")  # works AOK

               SPY.Open     SPY.High       SPY.Low    SPY.Close SPY.Volume
SPY.Adjusted
2012-02-22           NA           NA            NA           NA
NA           NA
2012-02-22 -0.003437431 -0.003648304 -0.0019110621 -0.003224152 -0.0715222
-0.003224152
2012-02-23 -0.002201673  0.001318198 -0.0021356506  0.004410792  0.1064559
0.004410792
2012-02-24  0.007134451  0.003437431  0.0083394834  0.002195711 -0.2335817
0.002195711
2012-02-27 -0.006645731  0.002405248 -0.0060748006  0.001679690  0.3808048
0.001679690
2012-02-28  0.008675195  0.001381517  0.0083210604  0.002916302 -0.1123525
0.002916302
2012-02-29  0.004081633  0.003412721 -0.0028481706 -0.003925560  0.4373886
-0.003925560
2012-03-01 -0.003266551 -0.001447283  0.0028563058  0.005181725 -0.2200299
0.005181725
2012-03-02  0.002403321 -0.001231973  0.0005112101 -0.003049445 -0.1681465
-0.003049445
2012-03-05 -0.003923278 -0.004498621 -0.0052554745 -0.004078363  0.1652850
-0.004078363

sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252
LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] timeSeries_2130.90           timeDate_2130.91
PerformanceAnalytics_1.0.3.3
[4] quantmod_0.3-17              TTR_0.21-0
xts_0.8-2
[7] zoo_1.7-5                    Defaults_1.1-1

loaded via a namespace (and not attached):
[1] grid_2.12.1     lattice_0.19-13

	[[alternative HTML version deleted]]

