2
R version 2.11.1 Patched (2010-09-30 r53135)
3
Copyright (C) 2010 The R Foundation for Statistical Computing
2
R version 2.12.1 Patched (2011-01-04 r53915)
3
Copyright (C) 2011 The R Foundation for Statistical Computing
5
Platform: i486-pc-linux-gnu (32-bit)
6
7
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
8
You are welcome to redistribute it under certain conditions.
28
29
> s <- as.simple_triplet_matrix(x)
29
30
> z <- as.matrix(s)
31
> identical(rollup(z, 2L, INDEX, sum),
32
+ as.matrix(rollup(s, 2L, INDEX, sum)))
32
> rollup(z, 2L, rep(1L, 20L), fivenum)
40
> identical(rollup(z, 2L, INDEX),
41
+ as.matrix(rollup(s, 2L, INDEX)))
34
> identical(rollup(t(z), 1L, INDEX, sum),
35
+ as.matrix(rollup(t(s), 1L, INDEX, sum)))
43
> identical(rollup(t(z), 1L, INDEX),
44
+ as.matrix(rollup(t(s), 1L, INDEX)))
40
49
> is.na(k) <- k == 1L
43
> identical(as.matrix(rollup(s, 2L, k, sum)),
44
+ rollup(z, 2L, k, sum))
52
> identical(as.matrix(rollup(s, 2L, k)),
49
58
> ## other data types
50
59
> s$v <- as.integer(s$v)
52
> identical(rollup(z, 2L, INDEX, sum),
53
+ as.matrix(rollup(s, 2L, INDEX, sum)))
61
> identical(rollup(z, 2L, INDEX),
62
+ as.matrix(rollup(s, 2L, INDEX)))
58
67
> z <- as.matrix(s)
59
68
> z[] <- as.double(z) # coerce
61
> identical(rollup(z, 2L, INDEX, sum),
62
+ as.matrix(rollup(s, 2L, INDEX, sum)))
70
> identical(rollup(z, 2L, INDEX),
71
+ as.matrix(rollup(s, 2L, INDEX)))
64
> identical(rollup(z, 2L, INDEX, sum, na.rm = TRUE),
65
+ as.matrix(rollup(s, 2L, INDEX, sum, na.rm = TRUE)))
73
> identical(rollup(z, 2L, INDEX, na.rm = TRUE),
74
+ as.matrix(rollup(s, 2L, INDEX, na.rm = TRUE)))
69
78
> s$v <- as.double(s$v)
71
> identical(rollup(z, 2L, INDEX, sum, na.rm = TRUE),
72
+ as.matrix(rollup(s, 2L, INDEX, sum, na.rm = TRUE)))
80
> identical(rollup(z, 2L, INDEX, na.rm = TRUE),
81
+ as.matrix(rollup(s, 2L, INDEX, na.rm = TRUE)))
77
86
> s <- as.simple_sparse_array(s)
80
> identical(rollup(z, 2L, INDEX, sum, na.rm = TRUE),
81
+ as.array(rollup(s, 2L, INDEX, sum, na.rm = TRUE)))
89
> identical(rollup(z, 2L, INDEX, na.rm = TRUE),
90
+ as.array(rollup(s, 2L, INDEX, na.rm = TRUE)))
85
94
> INDEX <- rep(1, dim(x)[2L])
87
> identical(rollup(z, 2L, INDEX, sum, na.rm = TRUE),
88
+ as.array(rollup(s, 2L, INDEX, sum, na.rm = TRUE)))
96
> identical(rollup(z, 2L, INDEX, na.rm = TRUE),
97
+ as.array(rollup(s, 2L, INDEX, na.rm = TRUE)))
91
100
> s <- as.simple_triplet_matrix(s)
92
> identical(rollup(z, 2L, INDEX, sum, na.rm = TRUE),
93
+ as.array(rollup(s, 2L, INDEX, sum, na.rm = TRUE)))
101
> identical(rollup(z, 2L, INDEX, na.rm = TRUE),
102
+ as.array(rollup(s, 2L, INDEX, na.rm = TRUE)))