Displaying 1 result from an estimated 1 matches for "dumpmatrix".
Did you mean:
dspmatrix
2007 Aug 07
1
sink behavior
...e' that produces an object which I can
only write to a file using the sink() function. It works fine if the
sink() command is not inside of a function, but it does not write
anything to the file if the command is within a function.
Sample code:
# Using a matrix because as a simple example.
dumpMatrix = function(mat) {
sink(file = "mat.txt")
mat
sink(NULL)
}
# This will write the file correctly.
x = matrix(100, 10, 10)
sink(file = "x.txt")
x
sink(NULL)
# This will create an empty file.
dumpMatrix(x)
R 2.5.1
Windows XP, SP2
The sink() docs are full of warnings,...