Hi Steven, I thought that the problem might be in the two large numbers, but using a subset (I didn't want to edit out all the line numbers), I get what I expected:
sydf<-read.table(text="Mean Std.dev [1,] 0.3107966 0.462820 [2,] 0.1880302 0.390736 [3,] 45.3185794 16.313635 [4,] 0.5066370 0.499956 [5,] 0.4933630 0.499956 [6,] 0.7029150 0.456974 [7,] 0.2970850 0.456974 [8,] 0.7967066 0.402449 [9,] 0.2032934 0.402449", stringsAsFactors=FALSE,header=TRUE) > print(sydf,digits=2) Mean Std.dev [1,] 0.31 0.46 [2,] 0.19 0.39 [3,] 45.32 16.31 [4,] 0.51 0.50 [5,] 0.49 0.50 [6,] 0.70 0.46 [7,] 0.30 0.46 [8,] 0.80 0.40 [9,] 0.20 0.40 I don't think it is your use of "cbind", but I didn't edit out Mean and Std.dev and try it. Jim On Tue, Nov 22, 2022 at 7:41 AM Steven T. Yen via R-help <r-help@r-project.org> wrote: > > Hi, I have two variables with 86 observations each. Below I print with > the print command with digit=2. But, I am getting three decimal places > for my first variable and two for the second. Please help. Thanks. > > > cbind(Mean,Std.dev) > Mean Std.dev > [1,] 0.3107966 0.462820 > [2,] 0.1880302 0.390736 > [3,] 45.3185794 16.313635 > [4,] 0.5066370 0.499956 > [5,] 0.4933630 0.499956 > [6,] 0.7029150 0.456974 > [7,] 0.2970850 0.456974 > [8,] 0.7967066 0.402449 > [9,] 0.2032934 0.402449 > [10,] 0.6582301 0.474303 > [11,] 0.3417699 0.474303 > [12,] 0.7262913 0.445861 > [13,] 0.2737087 0.445861 > [14,] 0.6415484 0.479546 > [15,] 0.3584516 0.479546 > [16,] 0.9110264 0.284706 > [17,] 0.0889736 0.284706 > [18,] 0.5211453 0.499553 > [19,] 0.4788547 0.499553 > [20,] 0.5481055 0.497680 > [21,] 0.4518945 0.497680 > [22,] 0.9135090 0.281088 > [23,] 0.0864910 0.281088 > [24,] 0.8727269 0.333279 > [25,] 0.1272731 0.333279 > [26,] 0.1015717 0.302084 > [27,] 0.6043692 0.488986 > [28,] 0.2940592 0.455619 > [29,] 0.2735274 0.445769 > [30,] 0.3777426 0.484823 > [31,] 0.3487300 0.476568 > [32,] 0.1603127 0.366896 > [33,] 0.1723783 0.377709 > [34,] 0.1230961 0.328547 > [35,] 0.1779381 0.382461 > [36,] 0.0964334 0.295185 > [37,] 0.1584698 0.365181 > [38,] 0.1113717 0.314592 > [39,] 0.3349813 0.471984 > [40,] 0.4081109 0.491484 > [41,] 0.2569078 0.436928 > [42,] 0.1034356 0.304527 > [43,] 0.6741233 0.468701 > [44,] 0.1254412 0.331218 > [45,] 0.0969999 0.295958 > [46,] 0.0587457 0.235148 > [47,] 0.4401115 0.496400 > [48,] 0.4689114 0.499033 > [49,] 0.0322313 0.176614 > [50,] 0.5907618 0.491693 > [51,] 0.1591195 0.365787 > [52,] 0.1132923 0.316950 > [53,] 0.1124207 0.315883 > [54,] 0.0244058 0.154305 > [55,] 0.7058787 0.455647 > [56,] 0.2941213 0.455647 > [57,] 0.0746892 0.262889 > [58,] 0.4749110 0.499370 > [59,] 0.3471837 0.476075 > [60,] 0.0435036 0.203988 > [61,] 0.0597126 0.236954 > [62,] 0.0478775 0.213507 > [63,] 0.1152615 0.319337 > [64,] 0.2074968 0.405514 > [65,] 0.2440626 0.429530 > [66,] 0.1605995 0.367161 > [67,] 0.0804598 0.272004 > [68,] 0.1442422 0.351335 > [69,] 0.3443231 0.475147 > [70,] 0.4280560 0.494797 > [71,] 0.0528221 0.223678 > [72,] 0.0805222 0.272100 > [73,] 0.0457169 0.208870 > [74,] 0.0485596 0.214945 > [75,] 0.1333443 0.339946 > [76,] 0.0932917 0.290841 > [77,] 0.0653987 0.247228 > [78,] 0.0573934 0.232593 > [79,] 0.1399086 0.346892 > [80,] 0.0887337 0.284359 > [81,] 0.0984479 0.297919 > [82,] 0.0914421 0.288237 > [83,] 0.1155505 0.319685 > [84,] 0.1363764 0.343188 > [85,] 0.1134570 0.317151 > [86,] 1.2985286 0.739096 > > print(cbind(Mean,Std.dev),digits=2) > Mean Std.dev > [1,] 0.311 0.46 > [2,] 0.188 0.39 > [3,] 45.319 16.31 > [4,] 0.507 0.50 > [5,] 0.493 0.50 > [6,] 0.703 0.46 > [7,] 0.297 0.46 > [8,] 0.797 0.40 > [9,] 0.203 0.40 > [10,] 0.658 0.47 > [11,] 0.342 0.47 > [12,] 0.726 0.45 > [13,] 0.274 0.45 > [14,] 0.642 0.48 > [15,] 0.358 0.48 > [16,] 0.911 0.28 > [17,] 0.089 0.28 > [18,] 0.521 0.50 > [19,] 0.479 0.50 > [20,] 0.548 0.50 > [21,] 0.452 0.50 > [22,] 0.914 0.28 > [23,] 0.086 0.28 > [24,] 0.873 0.33 > [25,] 0.127 0.33 > [26,] 0.102 0.30 > [27,] 0.604 0.49 > [28,] 0.294 0.46 > [29,] 0.274 0.45 > [30,] 0.378 0.48 > [31,] 0.349 0.48 > [32,] 0.160 0.37 > [33,] 0.172 0.38 > [34,] 0.123 0.33 > [35,] 0.178 0.38 > [36,] 0.096 0.30 > [37,] 0.158 0.37 > [38,] 0.111 0.31 > [39,] 0.335 0.47 > [40,] 0.408 0.49 > [41,] 0.257 0.44 > [42,] 0.103 0.30 > [43,] 0.674 0.47 > [44,] 0.125 0.33 > [45,] 0.097 0.30 > [46,] 0.059 0.24 > [47,] 0.440 0.50 > [48,] 0.469 0.50 > [49,] 0.032 0.18 > [50,] 0.591 0.49 > [51,] 0.159 0.37 > [52,] 0.113 0.32 > [53,] 0.112 0.32 > [54,] 0.024 0.15 > [55,] 0.706 0.46 > [56,] 0.294 0.46 > [57,] 0.075 0.26 > [58,] 0.475 0.50 > [59,] 0.347 0.48 > [60,] 0.044 0.20 > [61,] 0.060 0.24 > [62,] 0.048 0.21 > [63,] 0.115 0.32 > [64,] 0.207 0.41 > [65,] 0.244 0.43 > [66,] 0.161 0.37 > [67,] 0.080 0.27 > [68,] 0.144 0.35 > [69,] 0.344 0.48 > [70,] 0.428 0.49 > [71,] 0.053 0.22 > [72,] 0.081 0.27 > [73,] 0.046 0.21 > [74,] 0.049 0.21 > [75,] 0.133 0.34 > [76,] 0.093 0.29 > [77,] 0.065 0.25 > [78,] 0.057 0.23 > [79,] 0.140 0.35 > [80,] 0.089 0.28 > [81,] 0.098 0.30 > [82,] 0.091 0.29 > [83,] 0.116 0.32 > [84,] 0.136 0.34 > [85,] 0.113 0.32 > [86,] 1.299 0.74 > > > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.