download code
## Chunk 1
library("RBioinf")
require("methods")
## Chunk 2
## setVNames = function(x, nm)
## {
##     browser()
##     names(x) = nm
##     asSimpleVector(x, "numeric")
## }
## Chunk 3
x = 1:10
x = setVNames(x, letters[1:10])
## Chunk 4
 foo=function(x, y) {
   x = 10
   z = 20
  baz(100)
 }
library("codetools")
 findGlobals(foo)
## Chunk 5
findLocals(body(foo))
## Chunk 6
 checkUsage(foo, name="foo", all=TRUE)
## Chunk 7
##   x = convertMode(1:4, list())
## Chunk 8
## traceback()
## Chunk 9
saveopt = options(warn=2)
## Chunk 10
options(saveopt)
## Chunk 11
## withCallingHandlers(expression,
##     warning=function(c) recover())
## Chunk 12
 options(error=recover)
## Chunk 13
## x = convertMode(1:4, list())
## Chunk 14
## rm("setVNames")
## Chunk 15
x = matrix(1:4, nrow=2)
names(setVNames(x, letters[1:4]))
## Chunk 16
debug(asSimpleVector)
## Chunk 17
## names(setVNames(x, letters[1:4]))
## Chunk 18
undebug(asSimpleVector)
## Chunk 19
trace(asSimpleVector)
x = list(1:3, 4:5)
for (i in seq(along=x)) {
    x[[i]] = asSimpleVector(x[[i]], "complex")
}
untrace(asSimpleVector)
## Chunk 20
##  printWithNumbers(asSimpleVector)
## Chunk 21
trace(asSimpleVector, tracer=browser, at=9)
## Chunk 22
## names(setVNames(1:4, letters[1:4]))
## Chunk 23
untrace(asSimpleVector)
## Chunk 24
setGeneric("subsetAsCharacter")
## Chunk 25
setMethod("subsetAsCharacter",
          signature(x="character", i="missing",
                    j="missing"), function(x, i, j) x)
## Chunk 26
trace("subsetAsCharacter", tracer = browser,
    signature=c(x = "numeric"))
## Chunk 27
## subsetAsCharacter(1.5, 1:2)
## Chunk 28
subsetAsCharacter(1+0i, 1:2)
subsetAsCharacter("x")
untrace("subsetAsCharacter")
## Chunk 29
  Rprof()
  mad(runif(10000000))
  Rprof(NULL)
## Chunk 30
  summaryRprof()
## Chunk 31
gc()
## Chunk 32
ss = memory.profile()
sort(ss, decreasing=TRUE)
sum(ss)
## Chunk 33
 library("affy")
 library("affydata")
 data(Dilution)
 Rprof(file="profRMA", memory.profiling = TRUE)
 r1 = rma(Dilution)
 Rprof(NULL)
## Chunk 34
 pS = summaryRprof(file="profRMA", memory="tseries")
 names(pS)
## Chunk 35
plot(rownames(pS), pS$dup, type="l", xlab="Time", 
     ylab="Number of calls to duplicate")
## Chunk 36
  Rprofmem(file="rma2.out", threshold=100000)
  s2 = rma(Dilution)
  Rprofmem(NULL)  
## Chunk 37
## noquote(readLines("rma2.out", n=5))
## Chunk 38
length(readLines("rma2.out"))
## Chunk 39
 tracemem(Dilution)
 s3 <- rma(Dilution)
 tracemem(s3)