Created
July 30, 2014 20:58
-
-
Save lgatto/0641ecb695413a710695 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > isIn <- function(x, y) { | |
| + sel <- match(x, y) | |
| + y[sel] | |
| + } | |
| > x <- sample(LETTERS, 5) | |
| > isIn(x, LETTERS) | |
| [1] "Q" "Z" "K" "V" "U" | |
| > | |
| > x | |
| [1] "Q" "Z" "K" "V" "U" | |
| > isIn(x, LETTERS) | |
| [1] "Q" "Z" "K" "V" "U" | |
| > isIn(c(x, "a"), LETTERS) | |
| [1] "Q" "Z" "K" "V" "U" NA | |
| > debug(isIn) | |
| > isIn(c(x, "a"), LETTERS) | |
| debugging in: isIn(c(x, "a"), LETTERS) | |
| debug at #1: { | |
| sel <- match(x, y) | |
| y[sel] | |
| } | |
| Browse[2]> ls() | |
| [1] "x" "y" | |
| Browse[2]> x | |
| [1] "Q" "Z" "K" "V" "U" "a" | |
| Browse[2]> y | |
| [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" | |
| [20] "T" "U" "V" "W" "X" "Y" "Z" | |
| Browse[2]> | |
| debug at #2: sel <- match(x, y) | |
| Browse[2]> ls() | |
| [1] "x" "y" | |
| Browse[2]> | |
| debug at #3: y[sel] | |
| Browse[2]> ls() | |
| [1] "sel" "x" "y" | |
| Browse[2]> sel | |
| [1] 17 26 11 22 21 NA | |
| Browse[2]> y[sel] | |
| [1] "Q" "Z" "K" "V" "U" NA | |
| Browse[2]> sel[1:5] | |
| [1] 17 26 11 22 21 | |
| Browse[2]> sel <- sel[1:5] | |
| Browse[2]> sel | |
| [1] 17 26 11 22 21 | |
| Browse[2]> y[sel] | |
| [1] "Q" "Z" "K" "V" "U" | |
| Browse[2]> | |
| exiting from: isIn(c(x, "a"), LETTERS) | |
| [1] "Q" "Z" "K" "V" "U" | |
| > undeg(isIn) | |
| Error: could not find function "undeg" | |
| > undebug(isIn) | |
| > isIn(c(x, "a"), LETTERS) | |
| [1] "Q" "Z" "K" "V" "U" NA | |
| > fix(isIn) | |
| Waiting for Emacs... | |
| > isIn | |
| function(x, y) { | |
| print("hello") | |
| sel <- match(x, y) | |
| y[sel] | |
| } | |
| > library("RUnit") | |
| > | |
| + + + > x <- sample(LETTERS, 5) | |
| > isIn(x, LETTERS) | |
| [1] "H" "Y" "I" "X" "Z" | |
| > isIn(c(x, "a"), LETTERS) | |
| [1] "H" "Y" "I" "X" "Z" NA | |
| > | |
| Error in checkIdentical(x, isIn(c(x, "a"), LETTERS)) (from #4) : FALSE | |
| > [1] TRUE | |
| > | |
| > test_isIn() | |
| [1] TRUE | |
| > | |
| + + + > x <- sample(LETTERS, 5) | |
| > isIn(x, LETTERS) | |
| [1] "S" "A" "E" "C" "J" | |
| > isIn(c(x, "a"), LETTERS) | |
| [1] "S" "A" "E" "C" "J" NA | |
| > library("RUnit") | |
| > | |
| + + + + > test_isIn() | |
| Error in checkIdentical(x, isIn(c(x, "a"), LETTERS)) (from debug.R!2533YNG#4) : FALSE | |
| > x | |
| [1] "S" "A" "E" "C" "J" | |
| > isIn(c(x, "a"), LETTERS) | |
| [1] "S" "A" "E" "C" "J" NA | |
| > | |
| + + + > test_isIn() | |
| [1] TRUE | |
| > | |
| + + + > isIn(c(x, "a"), LETTERS) | |
| [1] "S" "A" "E" "C" "J" NA | |
| > traceback() | |
| 3: stop(paste(paste(result, collapse = "\n"), msg)) | |
| 2: checkIdentical(x, isIn(c(x, "a"), LETTERS)) at debug.R!2533YNG#4 | |
| 1: test_isIn() | |
| > stop("there is an error") | |
| Error: there is an error | |
| > options(error = recover) | |
| + . + > test_isIn() | |
| Error in checkIdentical(x, isIn(c(x, "a"), LETTERS)) (from debug.R!2533M2e#4) : FALSE | |
| Enter a frame number, or 0 to exit | |
| 1: test_isIn() | |
| 2: debug.R!2533M2e#4: checkIdentical(x, isIn(c(x, "a"), LETTERS)) | |
| Selection: 1 | |
| Called from: top level | |
| Browse[1]> ls() | |
| [1] "x" | |
| Browse[1]> x | |
| [1] "A" "B" "Z" | |
| Browse[1]> | |
| Enter a frame number, or 0 to exit | |
| 1: test_isIn() | |
| 2: debug.R!2533M2e#4: checkIdentical(x, isIn(c(x, "a"), LETTERS)) | |
| Selection: 0 | |
| > options(error = stop) | |
| > test_isIn() | |
| Error in checkIdentical(x, isIn(c(x, "a"), LETTERS)) (from debug.R!2533M2e#4) : FALSE | |
| Error during wrapup: | |
| > library("Biobase") | |
| Loading required package: BiocGenerics | |
| Loading required package: parallel | |
| Attaching package: ‘BiocGenerics’ | |
| The following objects are masked from ‘package:parallel’: | |
| clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, | |
| clusterExport, clusterMap, parApply, parCapply, parLapply, | |
| parLapplyLB, parRapply, parSapply, parSapplyLB | |
| The following object is masked from ‘package:stats’: | |
| xtabs | |
| The following objects are masked from ‘package:base’: | |
| anyDuplicated, append, as.data.frame, as.vector, cbind, colnames, | |
| do.call, duplicated, eval, evalq, Filter, Find, get, intersect, | |
| is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, | |
| pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int, | |
| rownames, sapply, setdiff, sort, table, tapply, union, unique, | |
| unlist | |
| Welcome to Bioconductor | |
| Vignettes contain introductory material; view with | |
| 'browseVignettes()'. To cite Bioconductor, see | |
| 'citation("Biobase")', and for packages 'citation("pkgname")'. | |
| > new("ExpressionSet") | |
| ExpressionSet (storageMode: lockedEnvironment) | |
| assayData: 0 features, 0 samples | |
| element names: exprs | |
| protocolData: none | |
| phenoData: none | |
| featureData: none | |
| experimentData: use 'experimentData(object)' | |
| Annotation: | |
| > validObject(new("ExpressionSet")) | |
| [1] TRUE | |
| > | |
| > | |
| > q("no") | |
| Process R finished at Wed Jul 30 16:47:04 2014 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment