| 1 | toInteger <- function(x, condition) |
| 2 | { |
| 3 | if (!is.integer(x)) |
| 4 | tryCatch( |
| 5 | {x = as.integer(x)[1]}, |
| 6 | error = function(e) paste("cannot convert argument",substitute(x),"to integer") |
| 7 | ) |
| 8 | if (!condition(x)) |
| 9 | stop(paste("argument",substitute(x),"does not verify condition",body(condition))) |
| 10 | x |
| 11 | } |
| 12 | |
| 13 | #TODO: merge these 2 next ?! |
| 14 | serialize = function(coeffs) |
| 15 | { |
| 16 | #......... |
| 17 | #C function (from data.frame, type of IDs ??! force integers ? [yes]) |
| 18 | #return raw vector |
| 19 | } |
| 20 | appendBinary = function(.......) |
| 21 | { |
| 22 | #take raw vector, append it (binary mode) to a file |
| 23 | } |
| 24 | |
| 25 | #finalizeSerialization = function(...) |
| 26 | #{ |
| 27 | # #write number of series, and length of each... |
| 28 | #} |
| 29 | |
| 30 | deserialize = function(coeffs, range) |
| 31 | { |
| 32 | #...... |
| 33 | #C function (from file name) |
| 34 | } |
| 35 | |
| 36 | getSeries(data, rank=NULL, id=NULL) |
| 37 | { |
| 38 | #TODO: |
| 39 | } |
| 40 | |
| 41 | getCoeffs(.....) #FROM BINARY FILE !!! |
| 42 | { |
| 43 | |
| 44 | } |