... | ... |
@@ -4,57 +4,57 @@ |
4 | 4 |
|
5 | 5 |
|
6 | 6 |
AGGREGATES <- function(value) { |
7 |
- op_list <- list(value = value) |
|
8 |
- ## Set the name for the class |
|
9 |
- class(op_list) <- "AGGREGATES" |
|
10 |
- return(op_list) |
|
7 |
+ op_list <- list(value = value) |
|
8 |
+ ## Set the name for the class |
|
9 |
+ class(op_list) <- "AGGREGATES" |
|
10 |
+ return(op_list) |
|
11 | 11 |
} |
12 | 12 |
|
13 | 13 |
check.META_AGGREGATES <- function(value) { |
14 |
- if(is.character(value) && length(value)>1) |
|
15 |
- stop("value: no multiple string") |
|
16 |
- |
|
17 |
- if(!is.character(value)) |
|
18 |
- stop("value: is not a string") |
|
14 |
+ if(is.character(value) && length(value)>1) |
|
15 |
+ stop("value: no multiple string") |
|
16 |
+ |
|
17 |
+ if(!is.character(value)) |
|
18 |
+ stop("value: is not a string") |
|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
META_AGGREGATES <- function(value) { |
22 |
- op_list <- list(value = value) |
|
23 |
- ## Set the name for the class |
|
24 |
- class(op_list) <- "META_AGGREGATES" |
|
25 |
- return(op_list) |
|
22 |
+ op_list <- list(value = value) |
|
23 |
+ ## Set the name for the class |
|
24 |
+ class(op_list) <- "META_AGGREGATES" |
|
25 |
+ return(op_list) |
|
26 | 26 |
} |
27 | 27 |
|
28 | 28 |
print.META_AGGREGATES <- function(obj) { |
29 |
- res <- as.character(obj) |
|
30 |
- cat(res) |
|
29 |
+ res <- as.character(obj) |
|
30 |
+ cat(res) |
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
as.character.META_AGGREGATES <- function(obj) { |
34 |
- class <- class(obj)[1] |
|
35 |
- val <- obj$value |
|
36 |
- c(class,val) |
|
34 |
+ class <- class(obj)[1] |
|
35 |
+ val <- obj$value |
|
36 |
+ c(class,val) |
|
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
take_value.META_AGGREGATES <- function(obj){ |
40 |
- class <- class(obj)[1] |
|
41 |
- val <- obj$value |
|
42 |
- text <- switch( |
|
43 |
- class, |
|
44 |
- "SUM" = paste0("sum_",val), |
|
45 |
- "MIN" = paste0("min_",val), |
|
46 |
- "MAX" = paste0("max_",val), |
|
47 |
- "COUNT" = paste0("count"), |
|
48 |
- "BAG" = paste0("bag_",val), |
|
49 |
- "BAGD" = paste0("bagd_",val), |
|
50 |
- "AVG" = paste0("avg_",val), |
|
51 |
- "STD" = paste0("std_"), |
|
52 |
- "MEDIAN" = paste0("median_",val), |
|
53 |
- "Q1" = paste0("q1_",val), |
|
54 |
- "Q2" = paste0("q2_"), |
|
55 |
- "Q3" = paste0("q3_",val) |
|
56 |
- ) |
|
57 |
- text |
|
40 |
+ class <- class(obj)[1] |
|
41 |
+ val <- obj$value |
|
42 |
+ text <- switch( |
|
43 |
+ class, |
|
44 |
+ "SUM" = paste0("sum_",val), |
|
45 |
+ "MIN" = paste0("min_",val), |
|
46 |
+ "MAX" = paste0("max_",val), |
|
47 |
+ "COUNT" = paste0("count"), |
|
48 |
+ "BAG" = paste0("bag_",val), |
|
49 |
+ "BAGD" = paste0("bagd_",val), |
|
50 |
+ "AVG" = paste0("avg_",val), |
|
51 |
+ "STD" = paste0("std_"), |
|
52 |
+ "MEDIAN" = paste0("median_",val), |
|
53 |
+ "Q1" = paste0("q1_",val), |
|
54 |
+ "Q2" = paste0("q2_"), |
|
55 |
+ "Q3" = paste0("q3_",val) |
|
56 |
+ ) |
|
57 |
+ text |
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
|
... | ... |
@@ -169,12 +169,12 @@ take_value.META_AGGREGATES <- function(obj){ |
169 | 169 |
#' @export |
170 | 170 |
#' |
171 | 171 |
SUM <- function(value) { |
172 |
- check.META_AGGREGATES(value) |
|
173 |
- |
|
174 |
- list <- list(value = value) |
|
175 |
- ## Set the name for the class |
|
176 |
- class(list) <- c("SUM","AGGREGATES","META_AGGREGATES") |
|
177 |
- return(list) |
|
172 |
+ check.META_AGGREGATES(value) |
|
173 |
+ |
|
174 |
+ list <- list(value = value) |
|
175 |
+ ## Set the name for the class |
|
176 |
+ class(list) <- c("SUM","AGGREGATES","META_AGGREGATES") |
|
177 |
+ return(list) |
|
178 | 178 |
} |
179 | 179 |
|
180 | 180 |
#' @name AGGREGATES-Object |
... | ... |
@@ -183,14 +183,14 @@ SUM <- function(value) { |
183 | 183 |
#' @export |
184 | 184 |
#' |
185 | 185 |
COUNT <- function() { |
186 |
- list <- list() |
|
187 |
- ## Set the name for the class |
|
188 |
- class(list) <- c("COUNT","AGGREGATES","META_AGGREGATES") |
|
189 |
- return(list) |
|
186 |
+ list <- list() |
|
187 |
+ ## Set the name for the class |
|
188 |
+ class(list) <- c("COUNT","AGGREGATES","META_AGGREGATES") |
|
189 |
+ return(list) |
|
190 | 190 |
} |
191 | 191 |
as.character.COUNT <- function(obj) { |
192 |
- class <- class(obj)[1] |
|
193 |
- c(class,"") |
|
192 |
+ class <- class(obj)[1] |
|
193 |
+ c(class,"") |
|
194 | 194 |
} |
195 | 195 |
check.COUNT <- function(obj){} |
196 | 196 |
|
... | ... |
@@ -201,14 +201,14 @@ check.COUNT <- function(obj){} |
201 | 201 |
#' @export |
202 | 202 |
#' |
203 | 203 |
COUNTSAMP <- function() { |
204 |
- list <- list() |
|
205 |
- ## Set the name for the class |
|
206 |
- class(list) <- c("COUNTSAMP","AGGREGATES","META_AGGREGATES") |
|
207 |
- return(list) |
|
204 |
+ list <- list() |
|
205 |
+ ## Set the name for the class |
|
206 |
+ class(list) <- c("COUNTSAMP","AGGREGATES","META_AGGREGATES") |
|
207 |
+ return(list) |
|
208 | 208 |
} |
209 | 209 |
as.character.COUNTSAMP <- function(obj) { |
210 |
- class <- class(obj)[1] |
|
211 |
- c(class,"") |
|
210 |
+ class <- class(obj)[1] |
|
211 |
+ c(class,"") |
|
212 | 212 |
} |
213 | 213 |
check.COUNTSAMP <- function(obj){} |
214 | 214 |
|
... | ... |
@@ -219,12 +219,12 @@ check.COUNTSAMP <- function(obj){} |
219 | 219 |
#' @export |
220 | 220 |
#' |
221 | 221 |
MIN <- function(value) { |
222 |
- check.META_AGGREGATES(value) |
|
223 |
- |
|
224 |
- list <- list(value = value) |
|
225 |
- ## Set the name for the class |
|
226 |
- class(list) <- c("MIN","AGGREGATES","META_AGGREGATES") |
|
227 |
- return(list) |
|
222 |
+ check.META_AGGREGATES(value) |
|
223 |
+ |
|
224 |
+ list <- list(value = value) |
|
225 |
+ ## Set the name for the class |
|
226 |
+ class(list) <- c("MIN","AGGREGATES","META_AGGREGATES") |
|
227 |
+ return(list) |
|
228 | 228 |
} |
229 | 229 |
|
230 | 230 |
#' @name AGGREGATES-Object |
... | ... |
@@ -233,12 +233,12 @@ MIN <- function(value) { |
233 | 233 |
#' @export |
234 | 234 |
#' |
235 | 235 |
MAX <- function(value) { |
236 |
- check.META_AGGREGATES(value) |
|
237 |
- |
|
238 |
- list <- list(value = value) |
|
239 |
- ## Set the name for the class |
|
240 |
- class(list) <- c("MAX","AGGREGATES","META_AGGREGATES") |
|
241 |
- return(list) |
|
236 |
+ check.META_AGGREGATES(value) |
|
237 |
+ |
|
238 |
+ list <- list(value = value) |
|
239 |
+ ## Set the name for the class |
|
240 |
+ class(list) <- c("MAX","AGGREGATES","META_AGGREGATES") |
|
241 |
+ return(list) |
|
242 | 242 |
} |
243 | 243 |
|
244 | 244 |
#' @name AGGREGATES-Object |
... | ... |
@@ -247,12 +247,12 @@ MAX <- function(value) { |
247 | 247 |
#' @export |
248 | 248 |
#' |
249 | 249 |
AVG <- function(value) { |
250 |
- check.META_AGGREGATES(value) |
|
251 |
- |
|
252 |
- list <- list(value = value) |
|
253 |
- ## Set the name for the class |
|
254 |
- class(list) <- c("AVG","AGGREGATES","META_AGGREGATES") |
|
255 |
- return(list) |
|
250 |
+ check.META_AGGREGATES(value) |
|
251 |
+ |
|
252 |
+ list <- list(value = value) |
|
253 |
+ ## Set the name for the class |
|
254 |
+ class(list) <- c("AVG","AGGREGATES","META_AGGREGATES") |
|
255 |
+ return(list) |
|
256 | 256 |
} |
257 | 257 |
|
258 | 258 |
#' @name AGGREGATES-Object |
... | ... |
@@ -261,12 +261,12 @@ AVG <- function(value) { |
261 | 261 |
#' @export |
262 | 262 |
#' |
263 | 263 |
MEDIAN <- function(value) { |
264 |
- check.META_AGGREGATES(value) |
|
265 |
- |
|
266 |
- list <- list(value = value) |
|
267 |
- ## Set the name for the class |
|
268 |
- class(list) <- c("MEDIAN","AGGREGATES","META_AGGREGATES") |
|
269 |
- return(list) |
|
264 |
+ check.META_AGGREGATES(value) |
|
265 |
+ |
|
266 |
+ list <- list(value = value) |
|
267 |
+ ## Set the name for the class |
|
268 |
+ class(list) <- c("MEDIAN","AGGREGATES","META_AGGREGATES") |
|
269 |
+ return(list) |
|
270 | 270 |
} |
271 | 271 |
|
272 | 272 |
|
... | ... |
@@ -276,12 +276,12 @@ MEDIAN <- function(value) { |
276 | 276 |
#' @export |
277 | 277 |
#' |
278 | 278 |
STD <- function(value) { |
279 |
- check.META_AGGREGATES(value) |
|
280 |
- |
|
281 |
- list <- list(value = value) |
|
282 |
- ## Set the name for the class |
|
283 |
- class(list) <- c("STD","META_AGGREGATES") |
|
284 |
- return(list) |
|
279 |
+ check.META_AGGREGATES(value) |
|
280 |
+ |
|
281 |
+ list <- list(value = value) |
|
282 |
+ ## Set the name for the class |
|
283 |
+ class(list) <- c("STD","META_AGGREGATES") |
|
284 |
+ return(list) |
|
285 | 285 |
} |
286 | 286 |
|
287 | 287 |
#' @name AGGREGATES-Object |
... | ... |
@@ -290,12 +290,12 @@ STD <- function(value) { |
290 | 290 |
#' @export |
291 | 291 |
#' |
292 | 292 |
BAG <- function(value) { |
293 |
- check.META_AGGREGATES(value) |
|
294 |
- |
|
295 |
- list <- list(value = value) |
|
296 |
- ## Set the name for the class |
|
297 |
- class(list) <- c("BAG","AGGREGATES","META_AGGREGATES") |
|
298 |
- return(list) |
|
293 |
+ check.META_AGGREGATES(value) |
|
294 |
+ |
|
295 |
+ list <- list(value = value) |
|
296 |
+ ## Set the name for the class |
|
297 |
+ class(list) <- c("BAG","AGGREGATES","META_AGGREGATES") |
|
298 |
+ return(list) |
|
299 | 299 |
} |
300 | 300 |
|
301 | 301 |
#' @name AGGREGATES-Object |
... | ... |
@@ -304,12 +304,12 @@ BAG <- function(value) { |
304 | 304 |
#' @export |
305 | 305 |
#' |
306 | 306 |
BAGD <- function(value) { |
307 |
- check.META_AGGREGATES(value) |
|
308 |
- |
|
309 |
- list <- list(value = value) |
|
310 |
- ## Set the name for the class |
|
311 |
- class(list) <- c("BAGD","AGGREGATES","META_AGGREGATES") |
|
312 |
- return(list) |
|
307 |
+ check.META_AGGREGATES(value) |
|
308 |
+ |
|
309 |
+ list <- list(value = value) |
|
310 |
+ ## Set the name for the class |
|
311 |
+ class(list) <- c("BAGD","AGGREGATES","META_AGGREGATES") |
|
312 |
+ return(list) |
|
313 | 313 |
} |
314 | 314 |
|
315 | 315 |
#' @name AGGREGATES-Object |
... | ... |
@@ -318,12 +318,12 @@ BAGD <- function(value) { |
318 | 318 |
#' @export |
319 | 319 |
#' |
320 | 320 |
Q1 <- function(value) { |
321 |
- check.META_AGGREGATES(value) |
|
322 |
- |
|
323 |
- list <- list(value = value) |
|
324 |
- ## Set the name for the class |
|
325 |
- class(list) <- c("Q1","META_AGGREGATES") |
|
326 |
- return(list) |
|
321 |
+ check.META_AGGREGATES(value) |
|
322 |
+ |
|
323 |
+ list <- list(value = value) |
|
324 |
+ ## Set the name for the class |
|
325 |
+ class(list) <- c("Q1","META_AGGREGATES") |
|
326 |
+ return(list) |
|
327 | 327 |
} |
328 | 328 |
|
329 | 329 |
#' @name AGGREGATES-Object |
... | ... |
@@ -332,11 +332,11 @@ Q1 <- function(value) { |
332 | 332 |
#' @export |
333 | 333 |
#' |
334 | 334 |
Q2 <- function(value) { |
335 |
- check.META_AGGREGATES(value) |
|
336 |
- list <- list(value = value) |
|
337 |
- ## Set the name for the class |
|
338 |
- class(list) <- c("Q2","META_AGGREGATES") |
|
339 |
- return(list) |
|
335 |
+ check.META_AGGREGATES(value) |
|
336 |
+ list <- list(value = value) |
|
337 |
+ ## Set the name for the class |
|
338 |
+ class(list) <- c("Q2","META_AGGREGATES") |
|
339 |
+ return(list) |
|
340 | 340 |
} |
341 | 341 |
|
342 | 342 |
#' @name AGGREGATES-Object |
... | ... |
@@ -345,10 +345,10 @@ Q2 <- function(value) { |
345 | 345 |
#' @export |
346 | 346 |
#' |
347 | 347 |
Q3 <- function(value) { |
348 |
- check.META_AGGREGATES(value) |
|
349 |
- |
|
350 |
- list <- list(value = value) |
|
351 |
- ## Set the name for the class |
|
352 |
- class(list) <- c("Q3","META_AGGREGATES") |
|
353 |
- return(list) |
|
348 |
+ check.META_AGGREGATES(value) |
|
349 |
+ |
|
350 |
+ list <- list(value = value) |
|
351 |
+ ## Set the name for the class |
|
352 |
+ class(list) <- c("Q3","META_AGGREGATES") |
|
353 |
+ return(list) |
|
354 | 354 |
} |
1 | 1 |
old mode 100644 |
2 | 2 |
new mode 100755 |
... | ... |
@@ -3,64 +3,61 @@ |
3 | 3 |
############################ |
4 | 4 |
|
5 | 5 |
|
6 |
-AGGREGATES <- function(value) |
|
7 |
-{ |
|
8 |
- op_list <- list(value = value) |
|
9 |
- ## Set the name for the class |
|
10 |
- class(op_list) <- "AGGREGATES" |
|
11 |
- return(op_list) |
|
6 |
+AGGREGATES <- function(value) { |
|
7 |
+ op_list <- list(value = value) |
|
8 |
+ ## Set the name for the class |
|
9 |
+ class(op_list) <- "AGGREGATES" |
|
10 |
+ return(op_list) |
|
12 | 11 |
} |
13 | 12 |
|
14 |
-check.META_AGGREGATES <- function(value) |
|
15 |
-{ |
|
16 |
- if(is.character(value) && length(value)>1) |
|
17 |
- stop("value: no multiple string") |
|
18 |
- |
|
19 |
- if(!is.character(value)) |
|
20 |
- stop("value: is not a string") |
|
13 |
+check.META_AGGREGATES <- function(value) { |
|
14 |
+ if(is.character(value) && length(value)>1) |
|
15 |
+ stop("value: no multiple string") |
|
16 |
+ |
|
17 |
+ if(!is.character(value)) |
|
18 |
+ stop("value: is not a string") |
|
21 | 19 |
} |
22 | 20 |
|
23 |
-META_AGGREGATES <- function(value) |
|
24 |
-{ |
|
25 |
- op_list <- list(value = value) |
|
26 |
- ## Set the name for the class |
|
27 |
- class(op_list) <- "META_AGGREGATES" |
|
28 |
- return(op_list) |
|
21 |
+META_AGGREGATES <- function(value) { |
|
22 |
+ op_list <- list(value = value) |
|
23 |
+ ## Set the name for the class |
|
24 |
+ class(op_list) <- "META_AGGREGATES" |
|
25 |
+ return(op_list) |
|
29 | 26 |
} |
30 | 27 |
|
31 | 28 |
print.META_AGGREGATES <- function(obj) { |
32 |
- res <- as.character(obj) |
|
33 |
- cat(res) |
|
29 |
+ res <- as.character(obj) |
|
30 |
+ cat(res) |
|
34 | 31 |
} |
35 | 32 |
|
36 | 33 |
as.character.META_AGGREGATES <- function(obj) { |
37 |
- class <- class(obj)[1] |
|
38 |
- val <- obj$value |
|
39 |
- c(class,val) |
|
34 |
+ class <- class(obj)[1] |
|
35 |
+ val <- obj$value |
|
36 |
+ c(class,val) |
|
40 | 37 |
} |
41 | 38 |
|
42 | 39 |
take_value.META_AGGREGATES <- function(obj){ |
43 |
- class <- class(obj)[1] |
|
44 |
- val <- obj$value |
|
45 |
- text <- switch(class, |
|
46 |
- "SUM" = paste0("sum_",val), |
|
47 |
- "MIN" = paste0("min_",val), |
|
48 |
- "MAX" = paste0("max_",val), |
|
49 |
- "COUNT" = paste0("count"), |
|
50 |
- "BAG" = paste0("bag_",val), |
|
51 |
- "BAGD" = paste0("bagd_",val), |
|
52 |
- "AVG" = paste0("avg_",val), |
|
53 |
- "STD" = paste0("std_"), |
|
54 |
- "MEDIAN" = paste0("median_",val), |
|
55 |
- "Q1" = paste0("q1_",val), |
|
56 |
- "Q2" = paste0("q2_"), |
|
57 |
- "Q3" = paste0("q3_",val) |
|
58 |
- ) |
|
59 |
- text |
|
40 |
+ class <- class(obj)[1] |
|
41 |
+ val <- obj$value |
|
42 |
+ text <- switch( |
|
43 |
+ class, |
|
44 |
+ "SUM" = paste0("sum_",val), |
|
45 |
+ "MIN" = paste0("min_",val), |
|
46 |
+ "MAX" = paste0("max_",val), |
|
47 |
+ "COUNT" = paste0("count"), |
|
48 |
+ "BAG" = paste0("bag_",val), |
|
49 |
+ "BAGD" = paste0("bagd_",val), |
|
50 |
+ "AVG" = paste0("avg_",val), |
|
51 |
+ "STD" = paste0("std_"), |
|
52 |
+ "MEDIAN" = paste0("median_",val), |
|
53 |
+ "Q1" = paste0("q1_",val), |
|
54 |
+ "Q2" = paste0("q2_"), |
|
55 |
+ "Q3" = paste0("q3_",val) |
|
56 |
+ ) |
|
57 |
+ text |
|
60 | 58 |
} |
61 | 59 |
|
62 | 60 |
|
63 |
- |
|
64 | 61 |
#' AGGREGATES object class constructor |
65 | 62 |
#' |
66 | 63 |
#' |
... | ... |
@@ -171,14 +168,13 @@ take_value.META_AGGREGATES <- function(obj){ |
171 | 168 |
#' @rdname aggr-class |
172 | 169 |
#' @export |
173 | 170 |
#' |
174 |
-SUM <- function(value) |
|
175 |
-{ |
|
176 |
- check.META_AGGREGATES(value) |
|
177 |
- |
|
178 |
- list <- list(value = value) |
|
179 |
- ## Set the name for the class |
|
180 |
- class(list) <- c("SUM","AGGREGATES","META_AGGREGATES") |
|
181 |
- return(list) |
|
171 |
+SUM <- function(value) { |
|
172 |
+ check.META_AGGREGATES(value) |
|
173 |
+ |
|
174 |
+ list <- list(value = value) |
|
175 |
+ ## Set the name for the class |
|
176 |
+ class(list) <- c("SUM","AGGREGATES","META_AGGREGATES") |
|
177 |
+ return(list) |
|
182 | 178 |
} |
183 | 179 |
|
184 | 180 |
#' @name AGGREGATES-Object |
... | ... |
@@ -186,16 +182,15 @@ SUM <- function(value) |
186 | 182 |
#' @rdname aggr-class |
187 | 183 |
#' @export |
188 | 184 |
#' |
189 |
-COUNT <- function() |
|
190 |
-{ |
|
191 |
- list <- list() |
|
192 |
- ## Set the name for the class |
|
193 |
- class(list) <- c("COUNT","AGGREGATES","META_AGGREGATES") |
|
194 |
- return(list) |
|
185 |
+COUNT <- function() { |
|
186 |
+ list <- list() |
|
187 |
+ ## Set the name for the class |
|
188 |
+ class(list) <- c("COUNT","AGGREGATES","META_AGGREGATES") |
|
189 |
+ return(list) |
|
195 | 190 |
} |
196 | 191 |
as.character.COUNT <- function(obj) { |
197 |
- class <- class(obj)[1] |
|
198 |
- c(class,"") |
|
192 |
+ class <- class(obj)[1] |
|
193 |
+ c(class,"") |
|
199 | 194 |
} |
200 | 195 |
check.COUNT <- function(obj){} |
201 | 196 |
|
... | ... |
@@ -205,16 +200,15 @@ check.COUNT <- function(obj){} |
205 | 200 |
#' @rdname aggr-class |
206 | 201 |
#' @export |
207 | 202 |
#' |
208 |
-COUNTSAMP <- function() |
|
209 |
-{ |
|
210 |
- list <- list() |
|
211 |
- ## Set the name for the class |
|
212 |
- class(list) <- c("COUNTSAMP","AGGREGATES","META_AGGREGATES") |
|
213 |
- return(list) |
|
203 |
+COUNTSAMP <- function() { |
|
204 |
+ list <- list() |
|
205 |
+ ## Set the name for the class |
|
206 |
+ class(list) <- c("COUNTSAMP","AGGREGATES","META_AGGREGATES") |
|
207 |
+ return(list) |
|
214 | 208 |
} |
215 | 209 |
as.character.COUNTSAMP <- function(obj) { |
216 |
- class <- class(obj)[1] |
|
217 |
- c(class,"") |
|
210 |
+ class <- class(obj)[1] |
|
211 |
+ c(class,"") |
|
218 | 212 |
} |
219 | 213 |
check.COUNTSAMP <- function(obj){} |
220 | 214 |
|
... | ... |
@@ -224,30 +218,27 @@ check.COUNTSAMP <- function(obj){} |
224 | 218 |
#' @rdname aggr-class |
225 | 219 |
#' @export |
226 | 220 |
#' |
227 |
-MIN <- function(value) |
|
228 |
-{ |
|
229 |
- check.META_AGGREGATES(value) |
|
230 |
- |
|
231 |
- list <- list(value = value) |
|
232 |
- ## Set the name for the class |
|
233 |
- class(list) <- c("MIN","AGGREGATES","META_AGGREGATES") |
|
234 |
- return(list) |
|
221 |
+MIN <- function(value) { |
|
222 |
+ check.META_AGGREGATES(value) |
|
223 |
+ |
|
224 |
+ list <- list(value = value) |
|
225 |
+ ## Set the name for the class |
|
226 |
+ class(list) <- c("MIN","AGGREGATES","META_AGGREGATES") |
|
227 |
+ return(list) |
|
235 | 228 |
} |
236 | 229 |
|
237 |
- |
|
238 | 230 |
#' @name AGGREGATES-Object |
239 | 231 |
#' @aliases MAX |
240 | 232 |
#' @rdname aggr-class |
241 | 233 |
#' @export |
242 | 234 |
#' |
243 |
-MAX <- function(value) |
|
244 |
-{ |
|
245 |
- check.META_AGGREGATES(value) |
|
246 |
- |
|
247 |
- list <- list(value = value) |
|
248 |
- ## Set the name for the class |
|
249 |
- class(list) <- c("MAX","AGGREGATES","META_AGGREGATES") |
|
250 |
- return(list) |
|
235 |
+MAX <- function(value) { |
|
236 |
+ check.META_AGGREGATES(value) |
|
237 |
+ |
|
238 |
+ list <- list(value = value) |
|
239 |
+ ## Set the name for the class |
|
240 |
+ class(list) <- c("MAX","AGGREGATES","META_AGGREGATES") |
|
241 |
+ return(list) |
|
251 | 242 |
} |
252 | 243 |
|
253 | 244 |
#' @name AGGREGATES-Object |
... | ... |
@@ -255,14 +246,13 @@ MAX <- function(value) |
255 | 246 |
#' @rdname aggr-class |
256 | 247 |
#' @export |
257 | 248 |
#' |
258 |
-AVG <- function(value) |
|
259 |
-{ |
|
260 |
- check.META_AGGREGATES(value) |
|
261 |
- |
|
262 |
- list <- list(value = value) |
|
263 |
- ## Set the name for the class |
|
264 |
- class(list) <- c("AVG","AGGREGATES","META_AGGREGATES") |
|
265 |
- return(list) |
|
249 |
+AVG <- function(value) { |
|
250 |
+ check.META_AGGREGATES(value) |
|
251 |
+ |
|
252 |
+ list <- list(value = value) |
|
253 |
+ ## Set the name for the class |
|
254 |
+ class(list) <- c("AVG","AGGREGATES","META_AGGREGATES") |
|
255 |
+ return(list) |
|
266 | 256 |
} |
267 | 257 |
|
268 | 258 |
#' @name AGGREGATES-Object |
... | ... |
@@ -270,14 +260,13 @@ AVG <- function(value) |
270 | 260 |
#' @rdname aggr-class |
271 | 261 |
#' @export |
272 | 262 |
#' |
273 |
-MEDIAN <- function(value) |
|
274 |
-{ |
|
275 |
- check.META_AGGREGATES(value) |
|
276 |
- |
|
277 |
- list <- list(value = value) |
|
278 |
- ## Set the name for the class |
|
279 |
- class(list) <- c("MEDIAN","AGGREGATES","META_AGGREGATES") |
|
280 |
- return(list) |
|
263 |
+MEDIAN <- function(value) { |
|
264 |
+ check.META_AGGREGATES(value) |
|
265 |
+ |
|
266 |
+ list <- list(value = value) |
|
267 |
+ ## Set the name for the class |
|
268 |
+ class(list) <- c("MEDIAN","AGGREGATES","META_AGGREGATES") |
|
269 |
+ return(list) |
|
281 | 270 |
} |
282 | 271 |
|
283 | 272 |
|
... | ... |
@@ -286,14 +275,13 @@ MEDIAN <- function(value) |
286 | 275 |
#' @rdname aggr-class |
287 | 276 |
#' @export |
288 | 277 |
#' |
289 |
-STD <- function(value) |
|
290 |
-{ |
|
291 |
- check.META_AGGREGATES(value) |
|
292 |
- |
|
293 |
- list <- list(value = value) |
|
294 |
- ## Set the name for the class |
|
295 |
- class(list) <- c("STD","META_AGGREGATES") |
|
296 |
- return(list) |
|
278 |
+STD <- function(value) { |
|
279 |
+ check.META_AGGREGATES(value) |
|
280 |
+ |
|
281 |
+ list <- list(value = value) |
|
282 |
+ ## Set the name for the class |
|
283 |
+ class(list) <- c("STD","META_AGGREGATES") |
|
284 |
+ return(list) |
|
297 | 285 |
} |
298 | 286 |
|
299 | 287 |
#' @name AGGREGATES-Object |
... | ... |
@@ -301,14 +289,13 @@ STD <- function(value) |
301 | 289 |
#' @rdname aggr-class |
302 | 290 |
#' @export |
303 | 291 |
#' |
304 |
-BAG <- function(value) |
|
305 |
-{ |
|
306 |
- check.META_AGGREGATES(value) |
|
307 |
- |
|
308 |
- list <- list(value = value) |
|
309 |
- ## Set the name for the class |
|
310 |
- class(list) <- c("BAG","AGGREGATES","META_AGGREGATES") |
|
311 |
- return(list) |
|
292 |
+BAG <- function(value) { |
|
293 |
+ check.META_AGGREGATES(value) |
|
294 |
+ |
|
295 |
+ list <- list(value = value) |
|
296 |
+ ## Set the name for the class |
|
297 |
+ class(list) <- c("BAG","AGGREGATES","META_AGGREGATES") |
|
298 |
+ return(list) |
|
312 | 299 |
} |
313 | 300 |
|
314 | 301 |
#' @name AGGREGATES-Object |
... | ... |
@@ -316,14 +303,13 @@ BAG <- function(value) |
316 | 303 |
#' @rdname aggr-class |
317 | 304 |
#' @export |
318 | 305 |
#' |
319 |
-BAGD <- function(value) |
|
320 |
-{ |
|
321 |
- check.META_AGGREGATES(value) |
|
322 |
- |
|
323 |
- list <- list(value = value) |
|
324 |
- ## Set the name for the class |
|
325 |
- class(list) <- c("BAGD","AGGREGATES","META_AGGREGATES") |
|
326 |
- return(list) |
|
306 |
+BAGD <- function(value) { |
|
307 |
+ check.META_AGGREGATES(value) |
|
308 |
+ |
|
309 |
+ list <- list(value = value) |
|
310 |
+ ## Set the name for the class |
|
311 |
+ class(list) <- c("BAGD","AGGREGATES","META_AGGREGATES") |
|
312 |
+ return(list) |
|
327 | 313 |
} |
328 | 314 |
|
329 | 315 |
#' @name AGGREGATES-Object |
... | ... |
@@ -331,14 +317,13 @@ BAGD <- function(value) |
331 | 317 |
#' @rdname aggr-class |
332 | 318 |
#' @export |
333 | 319 |
#' |
334 |
-Q1 <- function(value) |
|
335 |
-{ |
|
336 |
- check.META_AGGREGATES(value) |
|
337 |
- |
|
338 |
- list <- list(value = value) |
|
339 |
- ## Set the name for the class |
|
340 |
- class(list) <- c("Q1","META_AGGREGATES") |
|
341 |
- return(list) |
|
320 |
+Q1 <- function(value) { |
|
321 |
+ check.META_AGGREGATES(value) |
|
322 |
+ |
|
323 |
+ list <- list(value = value) |
|
324 |
+ ## Set the name for the class |
|
325 |
+ class(list) <- c("Q1","META_AGGREGATES") |
|
326 |
+ return(list) |
|
342 | 327 |
} |
343 | 328 |
|
344 | 329 |
#' @name AGGREGATES-Object |
... | ... |
@@ -346,13 +331,12 @@ Q1 <- function(value) |
346 | 331 |
#' @rdname aggr-class |
347 | 332 |
#' @export |
348 | 333 |
#' |
349 |
-Q2 <- function(value) |
|
350 |
-{ |
|
351 |
- check.META_AGGREGATES(value) |
|
352 |
- list <- list(value = value) |
|
353 |
- ## Set the name for the class |
|
354 |
- class(list) <- c("Q2","META_AGGREGATES") |
|
355 |
- return(list) |
|
334 |
+Q2 <- function(value) { |
|
335 |
+ check.META_AGGREGATES(value) |
|
336 |
+ list <- list(value = value) |
|
337 |
+ ## Set the name for the class |
|
338 |
+ class(list) <- c("Q2","META_AGGREGATES") |
|
339 |
+ return(list) |
|
356 | 340 |
} |
357 | 341 |
|
358 | 342 |
#' @name AGGREGATES-Object |
... | ... |
@@ -360,14 +344,11 @@ Q2 <- function(value) |
360 | 344 |
#' @rdname aggr-class |
361 | 345 |
#' @export |
362 | 346 |
#' |
363 |
-Q3 <- function(value) |
|
364 |
-{ |
|
365 |
- check.META_AGGREGATES(value) |
|
366 |
- |
|
367 |
- list <- list(value = value) |
|
368 |
- ## Set the name for the class |
|
369 |
- class(list) <- c("Q3","META_AGGREGATES") |
|
370 |
- return(list) |
|
347 |
+Q3 <- function(value) { |
|
348 |
+ check.META_AGGREGATES(value) |
|
349 |
+ |
|
350 |
+ list <- list(value = value) |
|
351 |
+ ## Set the name for the class |
|
352 |
+ class(list) <- c("Q3","META_AGGREGATES") |
|
353 |
+ return(list) |
|
371 | 354 |
} |
372 |
- |
|
373 |
- |
... | ... |
@@ -109,26 +109,26 @@ take_value.META_AGGREGATES <- function(obj){ |
109 | 109 |
#' ## and creation of results on disk. Then, with system.file() it defines |
110 | 110 |
#' ## the path to the folder "DATASET" in the subdirectory "example" |
111 | 111 |
#' ## of the package "RGMQL" and opens such folder as a GMQL dataset |
112 |
-#' ## named "exp" using customParser |
|
112 |
+#' ## named "exp" using CustomParser |
|
113 | 113 |
#' |
114 | 114 |
#' init_gmql() |
115 | 115 |
#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
116 | 116 |
#' exp = read_gmql(test_path) |
117 | 117 |
#' |
118 | 118 |
#' ## This statement copies all samples of exp dataset into res dataset, and |
119 |
-#' ## then calculates new metadata attribute 'sum_score' for each of them: |
|
119 |
+#' ## then calculates new metadata attribute sum_score for each of them: |
|
120 | 120 |
#' ## sum_score is the sum of score values of the sample regions. |
121 | 121 |
#' |
122 | 122 |
#' res = extend(exp, sum_score = SUM("score")) |
123 | 123 |
#' |
124 | 124 |
#' ## This statement copies all samples of exp dataset into res dataset, |
125 |
-#' ## and then calculates new metadata attribute 'min_pvalue' for each of them: |
|
125 |
+#' ## and then calculates new metadata attribute min_pvalue for each of them: |
|
126 | 126 |
#' ## min_pvalue is the minimum pvalue of the sample regions. |
127 | 127 |
#' |
128 | 128 |
#' res = extend(exp, min_pvalue = MIN("pvalue")) |
129 | 129 |
#' |
130 | 130 |
#' ## This statement copies all samples of exp dataset into res dataset, |
131 |
-#' ## and then calculates new metadata attribute 'max_score' for each of them: |
|
131 |
+#' ## and then calculates new metadata attribute max_score for each of them: |
|
132 | 132 |
#' ## max_score is the maximum score of the sample regions. |
133 | 133 |
#' |
134 | 134 |
#' res = extend(exp, max_score = MAX("score")) |
... | ... |
@@ -148,19 +148,19 @@ take_value.META_AGGREGATES <- function(obj){ |
148 | 148 |
#' out = extend(exp, allScore = BAG("score")) |
149 | 149 |
#' |
150 | 150 |
#' ## This statement counts the regions in each sample and stores their number |
151 |
-#' ## as value of the new metadata 'RegionCount' attribute of the sample. |
|
151 |
+#' ## as value of the new metadata RegionCount attribute of the sample. |
|
152 | 152 |
#' |
153 | 153 |
#' out = extend(exp, RegionCount = COUNT()) |
154 | 154 |
#' |
155 | 155 |
#' ## This statement copies all samples of exp dataset into res dataset, |
156 |
-#' ## and then calculates new metadata attribute 'std_score' for each of them: |
|
156 |
+#' ## and then calculates new metadata attribute std_score for each of them: |
|
157 | 157 |
#' ## std_score is the standard deviation of the score values of the sample |
158 | 158 |
#' ## regions. |
159 | 159 |
#' |
160 | 160 |
#' res = extend(exp, std_score = STD("score")) |
161 | 161 |
#' |
162 | 162 |
#' ## This statement copies all samples of exp dataset into res dataset, |
163 |
-#' ## and then calculates new metadata attribute 'm_score' for each of them: |
|
163 |
+#' ## and then calculates new metadata attribute m_score for each of them: |
|
164 | 164 |
#' ## m_score is the median score of the sample regions. |
165 | 165 |
#' |
166 | 166 |
#' res = extend(exp, m_score = MEDIAN("score")) |
... | ... |
@@ -73,7 +73,8 @@ take_value.META_AGGREGATES <- function(obj){ |
73 | 73 |
#' \item{COUNT: It prepares input parameter to be passed to the library |
74 | 74 |
#' function count, performing all the type conversions needed } |
75 | 75 |
#' \item{COUNTSAMP: It prepares input parameter to be passed to the library |
76 |
-#' function third quartile, performing all the type conversions needed } |
|
76 |
+#' function countsamp, performing all the type conversions needed. |
|
77 |
+#' It is used only with group_by functions} |
|
77 | 78 |
#' \item{MIN: It prepares input parameter to be passed to the library |
78 | 79 |
#' function minimum, performing all the type conversions needed } |
79 | 80 |
#' \item{MAX: It prepares input parameter to be passed to the library |
... | ... |
@@ -88,7 +89,7 @@ take_value.META_AGGREGATES <- function(obj){ |
88 | 89 |
#' function bag; this function creates comma-separated strings of |
89 | 90 |
#' attribute values, performing all the type conversions needed} |
90 | 91 |
#' \item{BAGD: It prepares input parameter to be passed to the library |
91 |
-#' function bag; this function creates comma-separated strings of distinct |
|
92 |
+#' function bagd; this function creates comma-separated strings of distinct |
|
92 | 93 |
#' attribute values, performing all the type conversions needed} |
93 | 94 |
#' \item{Q1: It prepares input parameter to be passed to the library |
94 | 95 |
#' function fist quartile, performing all the type conversions needed} |
... | ... |
@@ -112,22 +113,22 @@ take_value.META_AGGREGATES <- function(obj){ |
112 | 113 |
#' |
113 | 114 |
#' init_gmql() |
114 | 115 |
#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
115 |
-#' exp = read_GMQL(test_path) |
|
116 |
+#' exp = read_gmql(test_path) |
|
116 | 117 |
#' |
117 | 118 |
#' ## This statement copies all samples of exp dataset into res dataset, and |
118 |
-#' ## then calculates new metadata attribute for each of them: |
|
119 |
-#' ## sum_score is the sum of score of the sample regions. |
|
119 |
+#' ## then calculates new metadata attribute 'sum_score' for each of them: |
|
120 |
+#' ## sum_score is the sum of score values of the sample regions. |
|
120 | 121 |
#' |
121 | 122 |
#' res = extend(exp, sum_score = SUM("score")) |
122 | 123 |
#' |
123 | 124 |
#' ## This statement copies all samples of exp dataset into res dataset, |
124 |
-#' ## and then calculates new metadata attribute for each of them: |
|
125 |
+#' ## and then calculates new metadata attribute 'min_pvalue' for each of them: |
|
125 | 126 |
#' ## min_pvalue is the minimum pvalue of the sample regions. |
126 | 127 |
#' |
127 | 128 |
#' res = extend(exp, min_pvalue = MIN("pvalue")) |
128 | 129 |
#' |
129 | 130 |
#' ## This statement copies all samples of exp dataset into res dataset, |
130 |
-#' ## and then calculates new metadata attribute for each of them: |
|
131 |
+#' ## and then calculates new metadata attribute 'max_score' for each of them: |
|
131 | 132 |
#' ## max_score is the maximum score of the sample regions. |
132 | 133 |
#' |
133 | 134 |
#' res = extend(exp, max_score = MAX("score")) |
... | ... |
@@ -135,30 +136,31 @@ take_value.META_AGGREGATES <- function(obj){ |
135 | 136 |
#' ## The following cover operation produces output regions where at least 2 |
136 | 137 |
#' ## and at most 3 regions of exp dataset overlap, having as resulting region |
137 | 138 |
#' ## attribute the average signal of the overlapping regions; |
138 |
-#' ## the result has one sample for each input cell. |
|
139 |
+#' ## the result has one sample for each input cell value. |
|
139 | 140 |
#' |
140 | 141 |
#' res = cover(exp, 2, 3, groupBy = conds("cell"), avg_signal = AVG("signal")) |
141 | 142 |
#' |
142 |
-#' ## This statement copies all samples of DATA dataset into OUT dataset, |
|
143 |
-#' ## and then for each of them it adds another metadata attribute, allScores, |
|
143 |
+#' ## This statement copies all samples of 'exp' dataset into 'out' dataset, |
|
144 |
+#' ## and then for each of them it adds another metadata attribute, allScore, |
|
144 | 145 |
#' ## which is the aggregation comma-separated list of all the values |
145 | 146 |
#' ## that the region attribute score takes in the sample. |
146 | 147 |
#' |
147 | 148 |
#' out = extend(exp, allScore = BAG("score")) |
148 | 149 |
#' |
149 | 150 |
#' ## This statement counts the regions in each sample and stores their number |
150 |
-#' ## as value of the new metadata RegionCount attribute of the sample. |
|
151 |
+#' ## as value of the new metadata 'RegionCount' attribute of the sample. |
|
151 | 152 |
#' |
152 | 153 |
#' out = extend(exp, RegionCount = COUNT()) |
153 | 154 |
#' |
154 | 155 |
#' ## This statement copies all samples of exp dataset into res dataset, |
155 |
-#' ## and then calculates new metadata attribute for each of them: |
|
156 |
-#' ## std_score is the standard deviation score of the sample regions. |
|
156 |
+#' ## and then calculates new metadata attribute 'std_score' for each of them: |
|
157 |
+#' ## std_score is the standard deviation of the score values of the sample |
|
158 |
+#' ## regions. |
|
157 | 159 |
#' |
158 | 160 |
#' res = extend(exp, std_score = STD("score")) |
159 | 161 |
#' |
160 | 162 |
#' ## This statement copies all samples of exp dataset into res dataset, |
161 |
-#' ## and then calculates new metadata attribute for each of them: |
|
163 |
+#' ## and then calculates new metadata attribute 'm_score' for each of them: |
|
162 | 164 |
#' ## m_score is the median score of the sample regions. |
163 | 165 |
#' |
164 | 166 |
#' res = extend(exp, m_score = MEDIAN("score")) |
... | ... |
@@ -112,7 +112,7 @@ take_value.META_AGGREGATES <- function(obj){ |
112 | 112 |
#' |
113 | 113 |
#' init_gmql() |
114 | 114 |
#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
115 |
-#' exp = read_dataset(test_path) |
|
115 |
+#' exp = read_GMQL(test_path) |
|
116 | 116 |
#' |
117 | 117 |
#' ## This statement copies all samples of exp dataset into res dataset, and |
118 | 118 |
#' ## then calculates new metadata attribute for each of them: |
... | ... |
@@ -137,8 +137,7 @@ take_value.META_AGGREGATES <- function(obj){ |
137 | 137 |
#' ## attribute the average signal of the overlapping regions; |
138 | 138 |
#' ## the result has one sample for each input cell. |
139 | 139 |
#' |
140 |
-#' res = cover(exp, 2, 3, groupBy = list(DF("cell")), |
|
141 |
-#' avg_signal = AVG("signal") ) |
|
140 |
+#' res = cover(exp, 2, 3, groupBy = conds("cell"), avg_signal = AVG("signal")) |
|
142 | 141 |
#' |
143 | 142 |
#' ## This statement copies all samples of DATA dataset into OUT dataset, |
144 | 143 |
#' ## and then for each of them it adds another metadata attribute, allScores, |
... | ... |
@@ -72,6 +72,8 @@ take_value.META_AGGREGATES <- function(obj){ |
72 | 72 |
#' function sum, performing all the type conversions needed } |
73 | 73 |
#' \item{COUNT: It prepares input parameter to be passed to the library |
74 | 74 |
#' function count, performing all the type conversions needed } |
75 |
+#' \item{COUNTSAMP: It prepares input parameter to be passed to the library |
|
76 |
+#' function third quartile, performing all the type conversions needed } |
|
75 | 77 |
#' \item{MIN: It prepares input parameter to be passed to the library |
76 | 78 |
#' function minimum, performing all the type conversions needed } |
77 | 79 |
#' \item{MAX: It prepares input parameter to be passed to the library |
... | ... |
@@ -197,6 +199,25 @@ as.character.COUNT <- function(obj) { |
197 | 199 |
check.COUNT <- function(obj){} |
198 | 200 |
|
199 | 201 |
|
202 |