How to increase the printing limit in R?

R ProgrammingServer Side ProgrammingProgramming

When we deal with large data then the problem of printing the data or output of the analysis arises. Due to this problem, it becomes difficult to have a look at our complete but it can be avoided. Before importing any large data or performing any calculation that may result in big output, we can change the limit of the printing by using max.print option.

Example

> set.seed(1)
> sample(1:1000,555555,replace=TRUE)

Output

[99681] 223 62  961 304  5  262 519 357 415 167 855 523 268 486
[99695] 370 916 703 179 813 833 177 154 72  789 924 918 486 647
[99709] 971 41 347 460 557 793 370 639 762 28 274 273 849 228
[99723] 916 983 719 558 782 610 126 518 273 269 642 275 889 33
[99737] 192 254 723 322 686 914 932 462 44 986 510 951 384 527
[99751] 366 487 505 423 114 541 226 550 133 355 945 477 504 304
[99765] 313 324 288 239 801 79 171 318 299 591 784 833 9 493
[99779] 561 904 529 956 156 940 345 292 662 325 831 853 139 221
[99793] 252 717 592 427 9 740 999 24 197 887 69 421 41 5
[99807] 241 261 484 120 383 186 575 434 38 557 926 560 322 802
[99821] 912 532 147 588 646 639 990 134 563 483 783 164 392 503
[99835] 872 397 560 814 702 157 266 975 138 176 795 372 630 23
[99849] 5 542 770 870 553 212 712 714 548 192 717 444 240 272
[99863] 124 251 614 905 194 395 744 537 829 723 330 913 481 957
[99877] 66 971 805 247 948 194 444 864 755 374 399 166 532 847
[99891] 44 122 823 54 112 952 690 811 399 33 789 591 960 645
[99905] 703 725 968 166 969 442 868 579 23 138 24 300 459 734
[99919] 15 306 504 418 128 134 184 585 232 426 643 884 704 738
[99933] 281 476 134 409 57 664 563 69 251 667 462 358 565 964
[99947] 331 394 114 482 769 114 55 490 121 5 479 119 513 496
[99961] 521 39 989 488 586 979 901 211 937 604 928 128 678 769
[99975] 646 436 61 723 415 233 642 675 550 84 463 888 816 511
[99989] 800 711 429 404 555 29 168 471 146 235 315
[ reached getOption("max.print") -- omitted 455556 entries ]

Here, we can see that 455556 entries are omitted but we want all the entries to be printed. It can be done as shown below −

> options(max.print=999999)

Now again create the same sample −

> sample(1:1000,555555,replace=TRUE)

Output

[555227] 412 859 877 612 911 62 516 528 458 367 468 527 984 811
[555241] 750 550 92 595 723 557 636 140 244 426 579 858 811 922
[555255] 854 236 938 228 453 269 713 863 744 137 708 647 71 483
[555269] 7 640 51 667 384 61 572 933 158 790 563 318 800 409
[555283] 839 367 577 883 676 662 337 760 294 568 49 114 547 735
[555297] 403 744 276 177 943 374 218 651 363 374 810 546 602 707
[555311] 888 407 631 235 611 674 171 721 869 101 191 878 902 666
[555325] 124 564 744 909 233 43 769 321 210 637 854 27 874 639
[555339] 63 418 43 335 277 616 744 615 188 880 914 100 397 9
[555353] 848 605 568 350 909 184 145 937 81 656 133 722 94 41
[555367] 588 412 783 651 299 535 196 882 941 744 173 326 598 374
[555381] 22 871 78 559 845 274 141 750 191 549 318 297 721 754
[555395] 976 976 180 150 797 710 211 394 608 817 955 318 206 510
[555409] 360 683 452 73 937 381 781 706 725 179 931 333 878 468
[555423] 87 135 494 559 150 356 805 151 93 273 959 135 530 701
[555437] 729 554 303 516 107 838 22 673 804 13 308 303 920 203
[555451] 890 739 933 845 735 862 612 93 192 869 984 341 577 537
[555465] 381 324 884 204 800 454 315 985 891 56 584 578 182 890
[555479] 564 385 297 625 352 242 540 294 461 579 425 228 704 944
[555493] 282 873 597 976 823 818 567 199 566 728 545 161 508 512
[555507] 222 879 458 160 329 325 920 597 993 520 252 4 910 726
[555521] 760 701 952 202 334 278 115 856 21 688 693 959 760 443
[555535] 414 249 413 116 377 593 934 704 129 749 582 982 675 980
[555549] 89 285 738 898 395 250 446

Now all the values are printed.

raja
Published on 10-Aug-2020 13:13:22
Advertisements