Hello List,
When i paste a large block of R code from an editor to the R command line
the execution of the code will often fail at some point because it is not
pasted as it was copied.
===============================================================
Example:
I copied the following block of code (as part of a larger block):
....
s$Price <- quote(prices(St, uc=Adjusted, ent=c(Adjusted[-1], NA),
xit=c(Adjusted[-1], NA)))
s$PnL <- quote(pnl(Price, St))
s$PPnL <- quote(ppnl(Price, St))
s$RoR <- quote(ror(Price, St, delta=1/Price))
t = na.omit(trades(rownames(s), s$Price, s$St))
....
and when i paste this to the R command-line the following happens:
....
s$Price <- quote(prices(St, uc=Adjusted, ent=c(Adjusted[-1], NA),
xit=c(Adjusted[-1], NA)))
s$PnL <- quote(pnl(Price,
+
+ s$RoR <- quote(ror(Pr
+ t = na.omit(trade
Error: unexpected symbol in:
"s$RoR <- quote(ror(Pr
t"
....
=================================================================
As you can see from the example it looks like the code was not pasted
correctly.
If i execute the same block of code with the source() command it runs just
fine!