... | ... |
@@ -1,64 +1,64 @@ |
1 |
-########################################################################/** |
|
2 |
-# @RdocFunction cdfSetDimension |
|
3 |
-# |
|
4 |
-# @title "Sets the dimension of an object" |
|
5 |
-# |
|
6 |
-# \description{ |
|
7 |
-# @get "title". |
|
8 |
-# |
|
9 |
-# This @function is designed to be used with @see "applyCdfGroupFields". |
|
10 |
-# } |
|
11 |
-# |
|
12 |
-# @synopsis |
|
13 |
-# |
|
14 |
-# \arguments{ |
|
15 |
-# \item{groups}{A @list of groups.} |
|
16 |
-# \item{which}{An @integer or @character @vector of groups be returned.} |
|
17 |
-# \item{...}{Not used.} |
|
18 |
-# } |
|
19 |
-# |
|
20 |
-# \value{ |
|
21 |
-# Returns a @list structure of groups. |
|
22 |
-# } |
|
23 |
-# |
|
24 |
-# \seealso{ |
|
25 |
-# @see "applyCdfGroupFields". |
|
26 |
-# } |
|
27 |
-# |
|
28 |
-# @author "HB" |
|
29 |
-# |
|
30 |
-# @keyword programming |
|
31 |
-# @keyword internal |
|
32 |
-#**/####################################################################### |
|
33 |
-cdfSetDimension <- function(field, dim, ...) { |
|
34 |
- n <- length(field); |
|
35 |
- ndim <- length(dim); |
|
36 |
- |
|
37 |
- naDim <- which(is.na(dim)); |
|
38 |
- if (length(naDim) > 0) { |
|
39 |
- if (length(naDim) > 1) { |
|
40 |
- stop("Cannot infer dimension. Only one of the dimension can be unknown: ", paste(dim, collapse="x")); |
|
41 |
- } |
|
42 |
- dimNA <- n / prod(dim[-naDim]); |
|
43 |
- if (dimNA %% 1 == 0) { |
|
44 |
- dim[naDim] <- dimNA; |
|
45 |
- dim(field) <- dim; |
|
46 |
- } |
|
47 |
- } else if (n == prod(dim)) { |
|
48 |
- dim(field) <- dim; |
|
49 |
- } |
|
50 |
- |
|
51 |
- field; |
|
52 |
-} # cdfSetDimension() |
|
53 |
- |
|
54 |
- |
|
55 |
-############################################################################ |
|
56 |
-# HISTORY: |
|
57 |
-# 2013-09-23 |
|
58 |
-# o SPEEDUP/CLEANUP: Package now uses which() instead of whichVector() |
|
59 |
-# of 'R.utils'. Before R (< 2.11.0), which() used to be 10x slower |
|
60 |
-# than whichVector(), but now it's 3x faster. |
|
61 |
-# 2009-05-29 |
|
62 |
-# o Added Rdoc comments. |
|
63 |
-# o Created. |
|
64 |
-############################################################################ |
|
1 |
+########################################################################/** |
|
2 |
+# @RdocFunction cdfSetDimension |
|
3 |
+# |
|
4 |
+# @title "Sets the dimension of an object" |
|
5 |
+# |
|
6 |
+# \description{ |
|
7 |
+# @get "title". |
|
8 |
+# |
|
9 |
+# This @function is designed to be used with @see "applyCdfGroupFields". |
|
10 |
+# } |
|
11 |
+# |
|
12 |
+# @synopsis |
|
13 |
+# |
|
14 |
+# \arguments{ |
|
15 |
+# \item{field}{An R object.} |
|
16 |
+# \item{dim}{An @integer vector.} |
|
17 |
+# \item{...}{Not used.} |
|
18 |
+# } |
|
19 |
+# |
|
20 |
+# \value{ |
|
21 |
+# Returns a @list structure of groups. |
|
22 |
+# } |
|
23 |
+# |
|
24 |
+# \seealso{ |
|
25 |
+# @see "applyCdfGroupFields". |
|
26 |
+# } |
|
27 |
+# |
|
28 |
+# @author "HB" |
|
29 |
+# |
|
30 |
+# @keyword programming |
|
31 |
+# @keyword internal |
|
32 |
+#**/####################################################################### |
|
33 |
+cdfSetDimension <- function(field, dim, ...) { |
|
34 |
+ n <- length(field); |
|
35 |
+ ndim <- length(dim); |
|
36 |
+ |
|
37 |
+ naDim <- which(is.na(dim)); |
|
38 |
+ if (length(naDim) > 0) { |
|
39 |
+ if (length(naDim) > 1) { |
|
40 |
+ stop("Cannot infer dimension. Only one of the dimension can be unknown: ", paste(dim, collapse="x")); |
|
41 |
+ } |
|
42 |
+ dimNA <- n / prod(dim[-naDim]); |
|
43 |
+ if (dimNA %% 1 == 0) { |
|
44 |
+ dim[naDim] <- dimNA; |
|
45 |
+ dim(field) <- dim; |
|
46 |
+ } |
|
47 |
+ } else if (n == prod(dim)) { |
|
48 |
+ dim(field) <- dim; |
|
49 |
+ } |
|
50 |
+ |
|
51 |
+ field; |
|
52 |
+} # cdfSetDimension() |
|
53 |
+ |
|
54 |
+ |
|
55 |
+############################################################################ |
|
56 |
+# HISTORY: |
|
57 |
+# 2013-09-23 |
|
58 |
+# o SPEEDUP/CLEANUP: Package now uses which() instead of whichVector() |
|
59 |
+# of 'R.utils'. Before R (< 2.11.0), which() used to be 10x slower |
|
60 |
+# than whichVector(), but now it's 3x faster. |
|
61 |
+# 2009-05-29 |
|
62 |
+# o Added Rdoc comments. |
|
63 |
+# o Created. |
|
64 |
+############################################################################ |
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@80674 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -29,12 +29,12 @@ |
29 | 29 |
# |
30 | 30 |
# @keyword programming |
31 | 31 |
# @keyword internal |
32 |
-#**/####################################################################### |
|
32 |
+#**/####################################################################### |
|
33 | 33 |
cdfSetDimension <- function(field, dim, ...) { |
34 | 34 |
n <- length(field); |
35 | 35 |
ndim <- length(dim); |
36 | 36 |
|
37 |
- naDim <- whichVector(is.na(dim)); |
|
37 |
+ naDim <- which(is.na(dim)); |
|
38 | 38 |
if (length(naDim) > 0) { |
39 | 39 |
if (length(naDim) > 1) { |
40 | 40 |
stop("Cannot infer dimension. Only one of the dimension can be unknown: ", paste(dim, collapse="x")); |
... | ... |
@@ -54,6 +54,10 @@ cdfSetDimension <- function(field, dim, ...) { |
54 | 54 |
|
55 | 55 |
############################################################################ |
56 | 56 |
# HISTORY: |
57 |
+# 2013-09-23 |
|
58 |
+# o SPEEDUP/CLEANUP: Package now uses which() instead of whichVector() |
|
59 |
+# of 'R.utils'. Before R (< 2.11.0), which() used to be 10x slower |
|
60 |
+# than whichVector(), but now it's 3x faster. |
|
57 | 61 |
# 2009-05-29 |
58 | 62 |
# o Added Rdoc comments. |
59 | 63 |
# o Created. |
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@74592 bc3139a8-67e5-0310-9ffc-ced21a209358
Version: 1.17.2 [2009-02-20]
o BUG FIX: readChp() would crash (segmentation fault) for (at least)
some CHP files for GenomeWideSNP_5 generated by Affymetrix Power Tools.
o BUG FIX: Updated compareCels() to work with new readCelHeader().
Version: 1.17.1 [2009-05-09]
o Now readCelHeader() also reads DAT headers from Calvin CEL files.
Version: 1.17.0 [2009-04-20]
o Devel version bumped because of the new Bioconductor release.
Version: 1.16.0 [2009-04-20]
o Release version bumped because of the new Bioconductor release.
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@39806 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,60 @@ |
1 |
+########################################################################/** |
|
2 |
+# @RdocFunction cdfSetDimension |
|
3 |
+# |
|
4 |
+# @title "Sets the dimension of an object" |
|
5 |
+# |
|
6 |
+# \description{ |
|
7 |
+# @get "title". |
|
8 |
+# |
|
9 |
+# This @function is designed to be used with @see "applyCdfGroupFields". |
|
10 |
+# } |
|
11 |
+# |
|
12 |
+# @synopsis |
|
13 |
+# |
|
14 |
+# \arguments{ |
|
15 |
+# \item{groups}{A @list of groups.} |
|
16 |
+# \item{which}{An @integer or @character @vector of groups be returned.} |
|
17 |
+# \item{...}{Not used.} |
|
18 |
+# } |
|
19 |
+# |
|
20 |
+# \value{ |
|
21 |
+# Returns a @list structure of groups. |
|
22 |
+# } |
|
23 |
+# |
|
24 |
+# \seealso{ |
|
25 |
+# @see "applyCdfGroupFields". |
|
26 |
+# } |
|
27 |
+# |
|
28 |
+# @author |
|
29 |
+# |
|
30 |
+# @keyword programming |
|
31 |
+# @keyword internal |
|
32 |
+#**/####################################################################### |
|
33 |
+cdfSetDimension <- function(field, dim, ...) { |
|
34 |
+ n <- length(field); |
|
35 |
+ ndim <- length(dim); |
|
36 |
+ |
|
37 |
+ naDim <- whichVector(is.na(dim)); |
|
38 |
+ if (length(naDim) > 0) { |
|
39 |
+ if (length(naDim) > 1) { |
|
40 |
+ stop("Cannot infer dimension. Only one of the dimension can be unknown: ", paste(dim, collapse="x")); |
|
41 |
+ } |
|
42 |
+ dimNA <- n / prod(dim[-naDim]); |
|
43 |
+ if (dimNA %% 1 == 0) { |
|
44 |
+ dim[naDim] <- dimNA; |
|
45 |
+ dim(field) <- dim; |
|
46 |
+ } |
|
47 |
+ } else if (n == prod(dim)) { |
|
48 |
+ dim(field) <- dim; |
|
49 |
+ } |
|
50 |
+ |
|
51 |
+ field; |
|
52 |
+} # cdfSetDimension() |
|
53 |
+ |
|
54 |
+ |
|
55 |
+############################################################################ |
|
56 |
+# HISTORY: |
|
57 |
+# 2009-05-29 |
|
58 |
+# o Added Rdoc comments. |
|
59 |
+# o Created. |
|
60 |
+############################################################################ |