[R] How to suppress vector indexes in printout
jim holtman
jholtman at gmail.com
Sat Feb 6 15:52:24 CET 2010
You can always create your own output function. Here one way to do it:
> x <- runif(20)
> cat(strwrap(paste(x, collapse=' ')), sep='\n')
0.482080115471035 0.599565825425088 0.493541307048872
0.186217601411045 0.827373318606988
0.668466738192365 0.79423986072652 0.107943625887856 0.723710946040228
0.411274429643527
0.820946294115856 0.647060193819925 0.78293276228942 0.553036311641335
0.529719580197707
0.789356231689453 0.023331202333793 0.477230065036565 0.7323137386702
0.692731556482613
> # to get same size fields
> cat(strwrap(paste(sprintf("%.6f", x), collapse=' ')), sep='\n')
0.482080 0.599566 0.493541 0.186218 0.827373 0.668467 0.794240
0.107944 0.723711 0.411274
0.820946 0.647060 0.782933 0.553036 0.529720 0.789356 0.023331
0.477230 0.732314 0.692732
>
On Sat, Feb 6, 2010 at 9:34 AM, zumar <boguinsky at yandex.ru> wrote:
>
> I tried this, but I've got a printout in single line or with 'fill' option in
> multiline like this
> 0.6375758 1.060877 0.2509587 -0.1509616 0.819645 -0.3580455 -0.07430713
> -0.3464005 -2.312149 -0.8428289 0.8717265 -0.7302025 -0.5292043 -0.289512
> -1.231468 0.01108207 -1.811966 0.03652744 0.1809602 1.578322 1.100399
> 0.06806361 -1.062440 -0.1841067 -0.1975336 0.04150302 1.260545 -0.733543
> 0.3275387 -1.279669 -0.2939457 -1.814987 0.6008691 0.207336 1.362387
> 0.5739906
> 1.283922 0.04413182 -1.590986 0.4637798 -0.5791159 -0.1732862 -0.2332275
> It is not good-looking table, but of course, [1],[2] were disappeared.
> How to get this more better formated view:
> 0.637575751 1.060876635 0.250958721 -0.150961598 0.819644944
> -0.358045501 -0.074307126 -0.346400504 -2.312149002 -0.842828896
> 0.871726468 -0.730202499 -0.529204288 -0.289511989 -1.231467991
> 0.011082075 -1.811966480 0.036527445 0.180960181 1.578321545
> 1.100398735 0.068063611 -1.062439530 -0.184106670 -0.197533642
> 0.041503019 1.260544719 -0.733543065 0.327538693 -1.279668884
> ?
>
>
>
> --
> View this message in context: http://n4.nabble.com/How-to-suppress-vector-indexes-in-printout-tp1471295p1471318.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list