Hi All,
I am having some problem with SINK output. I am using sink to output the
following results:
print(paste("# id ", m))
print(paste(obs[1,1],obs[1,2],obs[1,3],obs[1,4]))
print(paste(obs[2,1],obs[2,2],obs[2,3],obs[2,4]))
and output file looks like this:
[1] 2119
[1] 5
[1] "# id 1"
[1] "C G G C"
[1] "C G T
C"
[1] "# id 2"
[1] "C G G C"
[1] "C G T T"
[1] "# id
3"
[1] "C G G C"
[1] "C G T T"
[1] "# id 4"
[1] "C G T
C"
[1] "C G T T"
Is there any way to
1. remove [1]
[WNV] use cat(...) instead of
print(...)
2. remove " "-quote
[WNV] use cat(...) instead of
print(...)
3. compress C G T C -> CGTC?
[WNV] use paste with a null
separator.
You probably want something like this below, which is a
little test demo:
obs <- matrix(c("C", "G",
"G", "C",
"C", "G", "T", "C"), ncol
= 4, byrow = T)
m <- 1
sink("test.txt")
cat("#id", m,
"\n")
cat(paste(obs[1, ], collapse = ""), "\n")
cat(paste(obs[2, ],
collapse = ""), "\n")
sink()
Your suggestions will be really appreciated.
Vincent
Don't get soaked. Take a
quick peak at the forecast
with theYahoo!
Search weather shortcut.