joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
330 stars 103 forks source link

runFun error reporting #32

Closed evelynmitchell closed 8 years ago

evelynmitchell commented 8 years ago

It may be helpful for debugging if the two conditions here were separated: if( n < 1 || n > NROW(x) ) stop("Invalid 'n'")

For example:

if( n < 1 ) stop("n, Number of rows of data, 0 or negative.")
# If possible, give  the actual n.

if( n > NROW(X) ) stop("Requested n greater than the length of provided data.")
# If possible give the actual n, and the comparison NROW(x), and x.