work on draft R package
[epclust.git] / code / draft_R_pkg / R / main.R
CommitLineData
3dcbfeef
BA
1#TODO: setRefClass... to avoid copy data !!
2#http://stackoverflow.com/questions/2603184/r-pass-by-reference
3
4#fields: data (can be NULL or provided by user), coeffs (will be computed
5#con can be a character string naming a file; see readLines()
6#data can be in DB format, on one column : TODO: guess (from header, or col. length...)
7epclust = function(data=NULL, con=NULL, raw=FALSE, K, nbPerChunk, ..., where_to_store_tmp_data, and how ?)
8#options for tmp files: in RAM, on disk, on DB (can be distributed)
ac1d4231
BA
9{
10
11
ac1d4231 12 #on input: can be data or con; data handled by writing it to file (ascii or bin ?!),
ac1d4231
BA
13
14
15 if (!is.null(data))
16 {
17 #full data matrix
3dcbfeef
BA
18 index = 1
19 n = nrow(data)
20 while (index < n)
21 {
22 getCoeffs(data
23 index = index + nbSeriesPerChunk
24 }
ac1d4231
BA
25 } else if (!is.null(con))
26 {
27 #incremental connection
28 #read it one by one and get coeffs until nbSeriesPerChunk
29 #then launch a clustering task............
3dcbfeef 30 readLines()
ac1d4231
BA
31 } else
32 stop("at least 'data' or 'con' argument must be present")
33
34}
3dcbfeef
BA
35
36getCoeffs = function(series)
37{
38 #... return wavelets coeffs : compute in parallel !
39}