1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,106 @@ |
1 |
+ |
|
2 |
+ |
|
3 |
+normalize.quantiles.determine.target <- function(x,target.length=NULL,subset=NULL){ |
|
4 |
+ |
|
5 |
+ if (!is.matrix(x)){ |
|
6 |
+ stop("This function expects supplied argument to be matrix") |
|
7 |
+ } |
|
8 |
+ if (!is.numeric(x)){ |
|
9 |
+ stop("Supplied argument should be a numeric matrix") |
|
10 |
+ } |
|
11 |
+ rows <- dim(x)[1] |
|
12 |
+ cols <- dim(x)[2] |
|
13 |
+ |
|
14 |
+ if (is.integer(x)){ |
|
15 |
+ x <- matrix(as.double(x), rows, cols) |
|
16 |
+ } |
|
17 |
+ |
|
18 |
+ if (is.null(target.length)){ |
|
19 |
+ target.length <- rows |
|
20 |
+ } |
|
21 |
+ |
|
22 |
+ if (target.length <= 0){ |
|
23 |
+ stop("Need positive length for target.length") |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+ if (is.null(subset)){ |
|
27 |
+ return(.Call("R_qnorm_determine_target",x,target.length,PACKAGE="preprocessCore")) |
|
28 |
+ } else { |
|
29 |
+ if (length(subset) != rows){ |
|
30 |
+ stop("subset should have same length as nrows(x)") |
|
31 |
+ } |
|
32 |
+ subset <- as.integer(subset) |
|
33 |
+ return(.Call("R_qnorm_determine_target_via_subset",x, subset,target.length,PACKAGE="preprocessCore")) |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+} |
|
37 |
+ |
|
38 |
+ |
|
39 |
+ |
|
40 |
+normalize.quantiles.use.target <- function(x,target,copy=TRUE,subset=NULL){ |
|
41 |
+ |
|
42 |
+ if (!is.matrix(x)){ |
|
43 |
+ stop("This function expects supplied argument to be matrix") |
|
44 |
+ } |
|
45 |
+ if (!is.numeric(x)){ |
|
46 |
+ stop("Supplied argument should be a numeric matrix") |
|
47 |
+ } |
|
48 |
+ rows <- dim(x)[1] |
|
49 |
+ cols <- dim(x)[2] |
|
50 |
+ |
|
51 |
+ if (is.integer(x)){ |
|
52 |
+ x <- matrix(as.double(x), rows, cols) |
|
53 |
+ } |
|
54 |
+ |
|
55 |
+ if (!is.vector(target)){ |
|
56 |
+ stop("This function expects target to be vector") |
|
57 |
+ } |
|
58 |
+ if (!is.numeric(target)){ |
|
59 |
+ stop("Supplied target argument should be a numeric vector") |
|
60 |
+ } |
|
61 |
+ |
|
62 |
+ if (is.integer(target)){ |
|
63 |
+ target <- as.double(target) |
|
64 |
+ } |
|
65 |
+ if (is.null(subset)){ |
|
66 |
+ return(.Call("R_qnorm_using_target",x,target,copy,PACKAGE="preprocessCore")) |
|
67 |
+ } else { |
|
68 |
+ if (length(subset) != rows){ |
|
69 |
+ stop("subset should have same length as nrows(x)") |
|
70 |
+ } |
|
71 |
+ subset <- as.integer(subset) |
|
72 |
+ return(.Call("R_qnorm_using_target_via_subset",x, subset, target, copy, PACKAGE="preprocessCore")) |
|
73 |
+ } |
|
74 |
+ |
|
75 |
+ |
|
76 |
+} |
|
77 |
+ |
|
78 |
+ |
|
79 |
+ |
|
80 |
+normalize.quantiles.in.blocks <- function(x,blocks,copy=TRUE){ |
|
81 |
+ |
|
82 |
+ rows <- dim(x)[1] |
|
83 |
+ cols <- dim(x)[2] |
|
84 |
+ |
|
85 |
+ if (rows != length(blocks)){ |
|
86 |
+ stop("blocks is not vector of correct length") |
|
87 |
+ } |
|
88 |
+ |
|
89 |
+ if (is.factor(blocks)){ |
|
90 |
+ blocks <- as.integer(blocks) |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ if (!is.numeric(blocks)){ |
|
94 |
+ stop("non-numeric vector used for blocks") |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ |
|
98 |
+ return(.Call("R_qnorm_within_blocks",x,blocks,copy,PACKAGE="preprocessCore")) |
|
99 |
+ |
|
100 |
+ |
|
101 |
+ |
|
102 |
+} |
|
103 |
+ |
|
104 |
+ |
|
105 |
+ |
|
106 |
+ |