To expand on what Joshua has already stated, here is a truncated parameter list of similar functions, along with the package to which they belong.
quantmod::Delt(x1,type = c("arithmetic", "log"))
quantmod::periodReturn(x, type='arithmetic') # log would be "log"
TTR::ROC(x, type=c("continuous", "discrete"))
Your choice are simple returns, which are
(today's_close - yesterday's_close) / yesterday's_close, or log returns, which are
log(today's_close) - log(yesterday's_close), or, equivalently,
log(today's_close / yesterday's_close). If you decide on simple returns, you must multiply returns to get the total return at the end of a period. With log returns you get to add them. This is preferred when your vector may have zeroes in it for obvious reasons. If you have a simple 1 or -1 signal, then you're only going to have a zero in the beginning, or an NA depending on which function you choose. But once you have a system that goes flat, or signals a 0, then you will have some trouble with simple returns.
Simple returns are referred to as arithmetic, discrete or simple in the above functions. The log returns are alternately referred to as log, continuous or compound.
Delt function is sort of an artifact and has been updated with the
dailyReturn function. Here is a snapshot of what each function generates on the first two lines of a trading system. Notice also that some have their defaults set to simple returns and others have default set to log returns. Each function allows you to change the default.
SLV.Close Delt dailyReturn ROC CalculateReturns
2010-01-04 17.23 NA 0.000000000 NA NA
2010-01-05 17.51 0.016250725 0.016250725 0.016120096 0.016120096
Remember that once you convert your returns to a log return, you need to un-convert it to get simple returns again, and this is accomplished by simply applying
My recent blog post about this topic may be of interest to you. http://www.milktrader.net/2011/04/chop-slice-and-dice-your-returns-in-r.html