[R] Remove [1] ... from output
François Pinard
pinard at iro.umontreal.ca
Tue Mar 28 16:01:51 CEST 2006
[Gregor Gorjanc]
>I am writing some numbers and character vectors to an ascii file and
>would like to get rid of [1] ... as shown bellow (a dummy example)
>R> runif(20)
> [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759
> [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737
>[17] 0.505706 0.412316 0.887421 0.812151
>I have managed to work up to remove quotes and all [*] except [1] as
>shown bellow.
>R> print(paste(runif(20), collapse = " "), quote = FALSE)
>[1] 0.790620362851769 0.45603066496551 0.563822037540376
>0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329
>0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474
>0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005
>0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496
>0.280175548279658
>Any hints how to solve my task?
You may use "cat" instead of "print". No need to "paste" then.
--
François Pinard http://pinard.progiciels-bpi.ca
More information about the R-help
mailing list