Re: [R] Format printing with R
On Tue, 22 Nov 2022 08:15:57 +0800 "Steven T. Yen" wrote: > Thanks to all, but no, signif() did not work: It worked, just didn't do what you wanted it to do. I think you want round(), not signif(). Some of your numbers (45.3185794) will be rounded to 4 significant digits and others (0.096) will be rounded to 1 significant digit, but the number of decimal places will be 2. -- Best regards, Ivan __ 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.
Re: [R] Hidden Problems with Clustering Algorithms
Most clustering algorithms are just heuristic and exploratory, well known to be subject to the sorts of issues that you are concerned with. There are no universal fixes ... just tradeoffs. You need to choose that which is most appropriate for your situation and data,. Bert On Mon, Nov 21, 2022, 19:28 Leonard Mada via R-help wrote: > Dear R-Users, > > Hidden Problems with Clustering Algorithms > > I stumbled recently upon a presentation about hierarchical clustering. > Unfortunately, it contains a hidden problem of clustering algorithms. > The problem is deeper and I think that it warrants a closer inspection > by the statistical community. > > The presentation is available online. Both the scaled & non-scaled > versions show the problem. > > de.NBI course - Advanced analysis of quantitative proteomics data using > R: 03b Clustering Part2 > [Note: it's more like introductory notes to basic statistics] > https://www.youtube.com/watch?v=7e1uW_BhljA > times: > - at 6:15 - 6:28 & 6:29 - 7:10 [2 versions, both non-scaled] > - at 5:51 - 6:10 [the scaled version] > - same problem at 7:56; > > PROBLEM > > Non-Scaled Version: (e.g. the one at 6:15) > - the upper 2 rows are split into various sub-clusters; > - the top tree: a cluster is formed by the right-right sub-tree (some 17 > "genes" or similar "activities" / "expressions"); > - the left-most 2 "genes" are actually over-expressed "genes" and > functionally really belong to the previous/right sub-cluster; > > Scaled-Version: (at 5:52) > - the left-most 2 "genes" are over-expressed at the same time with the > right cluster, and not otherwise; > > Unfortunately, the 2 over-expressed (outliers or extreme-values) are > split off from the relevant cluster and inserted as a separate > main-branch in the top dendrogram. Switching only the main left & right > branches in the top tree would only mask this problem. The 2 > pseudo-outliers are really the (probably) upper values in the larger > cluster of over-expressed "genes" (all the dark genes should belong to > the same cluster). > > The middle sub-cluster shows really NO activity (some 16 "genes"). The > main branches in the top tree should really split between this > *NO*-activity cluster and the cluster showing activity (including the 2 > massively over-expressed genes). The problem is present in the scaled > version as well. > > The hierarchical clustering algorithm fails. I have not analysed the > data, but some problems may contribute to this: > - "gene expression" or "activity" may not be linear, but exponential or > follow some power rule: a logarithmic transformation (or some other > transformation) may have been useful; > - simple distances between clusters may be too inaccurate; > - the variance in the low-activity (middle) cluster may be very low > (almost 0!), while the variance in the high-activity cluster may be much > higher: the Mahalanobis distance or joining the sub-clusters based on > some z/t-test taking into account the different variances may be more > robust; > > These questions should be addressed by more senior statisticians. > > I hope that the presentation remains on-line as is, as the clustering > problem is really easy to see and to analyse. It is impossible to detect > and visualise such anomalies in a heatmap with 1,000 gene-expressions or > with 10,000 genes, or with 500-1000 samples. It is very obvious on this > small heatmap. > > I do not know if there are any robust tools to validate the generated > trees. Inspecting by "eye" a dendrogram with > 1,000 genes and hundreds > of samples is really futile. > > Sincerely, > > Leonard > > __ > 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. > [[alternative HTML version deleted]] __ 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] Hidden Problems with Clustering Algorithms
Dear R-Users, Hidden Problems with Clustering Algorithms I stumbled recently upon a presentation about hierarchical clustering. Unfortunately, it contains a hidden problem of clustering algorithms. The problem is deeper and I think that it warrants a closer inspection by the statistical community. The presentation is available online. Both the scaled & non-scaled versions show the problem. de.NBI course - Advanced analysis of quantitative proteomics data using R: 03b Clustering Part2 [Note: it's more like introductory notes to basic statistics] https://www.youtube.com/watch?v=7e1uW_BhljA times: - at 6:15 - 6:28 & 6:29 - 7:10 [2 versions, both non-scaled] - at 5:51 - 6:10 [the scaled version] - same problem at 7:56; PROBLEM Non-Scaled Version: (e.g. the one at 6:15) - the upper 2 rows are split into various sub-clusters; - the top tree: a cluster is formed by the right-right sub-tree (some 17 "genes" or similar "activities" / "expressions"); - the left-most 2 "genes" are actually over-expressed "genes" and functionally really belong to the previous/right sub-cluster; Scaled-Version: (at 5:52) - the left-most 2 "genes" are over-expressed at the same time with the right cluster, and not otherwise; Unfortunately, the 2 over-expressed (outliers or extreme-values) are split off from the relevant cluster and inserted as a separate main-branch in the top dendrogram. Switching only the main left & right branches in the top tree would only mask this problem. The 2 pseudo-outliers are really the (probably) upper values in the larger cluster of over-expressed "genes" (all the dark genes should belong to the same cluster). The middle sub-cluster shows really NO activity (some 16 "genes"). The main branches in the top tree should really split between this *NO*-activity cluster and the cluster showing activity (including the 2 massively over-expressed genes). The problem is present in the scaled version as well. The hierarchical clustering algorithm fails. I have not analysed the data, but some problems may contribute to this: - "gene expression" or "activity" may not be linear, but exponential or follow some power rule: a logarithmic transformation (or some other transformation) may have been useful; - simple distances between clusters may be too inaccurate; - the variance in the low-activity (middle) cluster may be very low (almost 0!), while the variance in the high-activity cluster may be much higher: the Mahalanobis distance or joining the sub-clusters based on some z/t-test taking into account the different variances may be more robust; These questions should be addressed by more senior statisticians. I hope that the presentation remains on-line as is, as the clustering problem is really easy to see and to analyse. It is impossible to detect and visualise such anomalies in a heatmap with 1,000 gene-expressions or with 10,000 genes, or with 500-1000 samples. It is very obvious on this small heatmap. I do not know if there are any robust tools to validate the generated trees. Inspecting by "eye" a dendrogram with > 1,000 genes and hundreds of samples is really futile. Sincerely, Leonard __ 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.
Re: [R] Format printing with R
??? > vals <- signif(cbind(c(.123,.0123), c(1.23,.00123)), digits = 2) > print(vals) [,1] [,2] [1,] 0.120 1.2000 [2,] 0.012 0.0012 2 *significant* digits, but enough digits to right of decimal point to **allow** the two significant digits to appear and have all numbers in a column line up neatly. If you don't want them to line up, you will probably have to use cat() to print row by row. > for(i in 1:2)cat(vals[i,],"\n",sep = ' ') 0.12 1.2 0.012 0.0012 Further nuances can be found in ?format, which again tries to line things up in columns. -- Bert On Mon, Nov 21, 2022 at 4:58 PM Jeff Newmiller wrote: > > Andrew's example works for him and for me. > > If you want help, provide the output of > > dput(head(Mean)) > dput(head(Std.dev)) > > > On November 21, 2022 4:15:57 PM PST, "Steven T. Yen" wrote: > >Thanks to all, but no, signif() did not work: > > > >> print(signif(cbind(Mean,Std.dev),digits=2)) > >Mean Std.dev > > [1,] 0.3100.46 > > [2,] 0.1900.39 > > [3,] 45.000 16.00 > > [4,] 0.5100.50 > > [5,] 0.4900.50 > > [6,] 0.7000.46 > > > >On 11/22/2022 5:41 AM, Andrew Simmons wrote: > >> For print(), digits is the minimal number of significant digits. In > >> your case, rounding the first column to the 3rd decimal place gives at > >> least 2 sigfigs and rounding the second column to the 2nd decimal > >> place. > >> > >> If you want to print all numbers to two significant digits, regardless > >> of what other numbers are in the column, use signif() before print(): > >> > >> Mean <- c(0.3107966, 0.1880302, 45.3185794, 0.506637, 0.493363, > >> 0.702915, 0.297085, 0.7967066, 0.2032934, 0.6582301, 0.3417699, > >> 0.7262913, 0.2737087, 0.6415484, 0.3584516, 0.9110264, 0.0889736, > >> 0.5211453, 0.4788547, 0.5481055, 0.4518945, 0.913509, 0.086491, > >> 0.8727269, 0.1272731, 0.1015717, 0.6043692, 0.2940592, 0.2735274, > >> 0.3777426, 0.34873, 0.1603127, 0.1723783, 0.1230961, 0.1779381, > >> 0.0964334, 0.1584698, 0.1113717, 0.3349813, 0.4081109, 0.2569078, > >> 0.1034356, 0.6741233, 0.1254412, 0.096, 0.0587457, 0.4401115, > >> 0.4689114, 0.0322313, 0.5907618, 0.1591195, 0.1132923, 0.1124207, > >> 0.0244058, 0.7058787, 0.2941213, 0.0746892, 0.474911, 0.3471837, > >> 0.0435036, 0.0597126, 0.0478775, 0.1152615, 0.2074968, 0.2440626, > >> 0.1605995, 0.0804598, 0.1442422, 0.3443231, 0.428056, 0.0528221, > >> 0.0805222, 0.0457169, 0.0485596, 0.1333443, 0.0932917, 0.0653987, > >> 0.0573934, 0.1399086, 0.0887337, 0.0984479, 0.0914421, 0.1155505, > >> 0.1363764, 0.113457, 1.2985286) > >> Std.dev <- c(0.46282, 0.390736, 16.313635, 0.499956, 0.499956, > >> 0.456974, 0.456974, 0.402449, 0.402449, 0.474303, 0.474303, 0.445861, > >> 0.445861, 0.479546, 0.479546, 0.284706, 0.284706, 0.499553, 0.499553, > >> 0.49768, 0.49768, 0.281088, 0.281088, 0.333279, 0.333279, 0.302084, > >> 0.488986, 0.455619, 0.445769, 0.484823, 0.476568, 0.366896, 0.377709, > >> 0.328547, 0.382461, 0.295185, 0.365181, 0.314592, 0.471984, 0.491484, > >> 0.436928, 0.304527, 0.468701, 0.331218, 0.295958, 0.235148, 0.4964, > >> 0.499033, 0.176614, 0.491693, 0.365787, 0.31695, 0.315883, 0.154305, > >> 0.455647, 0.455647, 0.262889, 0.49937, 0.476075, 0.203988, 0.236954, > >> 0.213507, 0.319337, 0.405514, 0.42953, 0.367161, 0.272004, 0.351335, > >> 0.475147, 0.494797, 0.223678, 0.2721, 0.20887, 0.214945, 0.339946, > >> 0.290841, 0.247228, 0.232593, 0.346892, 0.284359, 0.297919, 0.288237, > >> 0.319685, 0.343188, 0.317151, 0.739096) > >> print(signif(cbind(Mean, Std.dev), 2)) > >> > >> which looks like: > >> > >>> print(signif(cbind(Mean, Std.dev), 2)) > >> Mean Std.dev > >> [1,] 0.3100.46 > >> [2,] 0.1900.39 > >> [3,] 45.000 16.00 > >> [4,] 0.5100.50 > >> [5,] 0.4900.50 > >> [6,] 0.7000.46 > >> [7,] 0.3000.46 > >> [8,] 0.8000.40 > >> [9,] 0.2000.40 > >> [10,] 0.6600.47 > >> [11,] 0.3400.47 > >> [12,] 0.7300.45 > >> [13,] 0.2700.45 > >> [14,] 0.6400.48 > >> [15,] 0.3600.48 > >> [16,] 0.9100.28 > >> [17,] 0.0890.28 > >> [18,] 0.5200.50 > >> [19,] 0.4800.50 > >> [20,] 0.5500.50 > >> [21,] 0.4500.50 > >> [22,] 0.9100.28 > >> [23,] 0.0860.28 > >> [24,] 0.8700.33 > >> [25,] 0.1300.33 > >> [26,] 0.1000.30 > >> [27,] 0.6000.49 > >> [28,] 0.2900.46 > >> [29,] 0.2700.45 > >> [30,] 0.3800.48 > >> [31,] 0.3500.48 > >> [32,] 0.1600.37 > >> [33,] 0.1700.38 > >> [34,] 0.1200.33 > >> [35,] 0.1800.38 > >> [36,] 0.0960.30 > >> [37,] 0.1600.37 > >> [38,] 0.1100.31 > >> [39,] 0.3300.47 > >> [40,] 0.4100.49 > >> [41,] 0.2600.44 > >> [42,] 0.1000.30 > >> [43,] 0.6700.47 > >> [44,] 0.1300.33 > >> [45,] 0.0970.30 > >> [46,] 0.0590.24 > >> [47,] 0.4400.50
Re: [R] Format printing with R
Andrew's example works for him and for me. If you want help, provide the output of dput(head(Mean)) dput(head(Std.dev)) On November 21, 2022 4:15:57 PM PST, "Steven T. Yen" wrote: >Thanks to all, but no, signif() did not work: > >> print(signif(cbind(Mean,Std.dev),digits=2)) > Mean Std.dev > [1,] 0.310 0.46 > [2,] 0.190 0.39 > [3,] 45.000 16.00 > [4,] 0.510 0.50 > [5,] 0.490 0.50 > [6,] 0.700 0.46 > >On 11/22/2022 5:41 AM, Andrew Simmons wrote: >> For print(), digits is the minimal number of significant digits. In >> your case, rounding the first column to the 3rd decimal place gives at >> least 2 sigfigs and rounding the second column to the 2nd decimal >> place. >> >> If you want to print all numbers to two significant digits, regardless >> of what other numbers are in the column, use signif() before print(): >> >> Mean <- c(0.3107966, 0.1880302, 45.3185794, 0.506637, 0.493363, >> 0.702915, 0.297085, 0.7967066, 0.2032934, 0.6582301, 0.3417699, >> 0.7262913, 0.2737087, 0.6415484, 0.3584516, 0.9110264, 0.0889736, >> 0.5211453, 0.4788547, 0.5481055, 0.4518945, 0.913509, 0.086491, >> 0.8727269, 0.1272731, 0.1015717, 0.6043692, 0.2940592, 0.2735274, >> 0.3777426, 0.34873, 0.1603127, 0.1723783, 0.1230961, 0.1779381, >> 0.0964334, 0.1584698, 0.1113717, 0.3349813, 0.4081109, 0.2569078, >> 0.1034356, 0.6741233, 0.1254412, 0.096, 0.0587457, 0.4401115, >> 0.4689114, 0.0322313, 0.5907618, 0.1591195, 0.1132923, 0.1124207, >> 0.0244058, 0.7058787, 0.2941213, 0.0746892, 0.474911, 0.3471837, >> 0.0435036, 0.0597126, 0.0478775, 0.1152615, 0.2074968, 0.2440626, >> 0.1605995, 0.0804598, 0.1442422, 0.3443231, 0.428056, 0.0528221, >> 0.0805222, 0.0457169, 0.0485596, 0.1333443, 0.0932917, 0.0653987, >> 0.0573934, 0.1399086, 0.0887337, 0.0984479, 0.0914421, 0.1155505, >> 0.1363764, 0.113457, 1.2985286) >> Std.dev <- c(0.46282, 0.390736, 16.313635, 0.499956, 0.499956, >> 0.456974, 0.456974, 0.402449, 0.402449, 0.474303, 0.474303, 0.445861, >> 0.445861, 0.479546, 0.479546, 0.284706, 0.284706, 0.499553, 0.499553, >> 0.49768, 0.49768, 0.281088, 0.281088, 0.333279, 0.333279, 0.302084, >> 0.488986, 0.455619, 0.445769, 0.484823, 0.476568, 0.366896, 0.377709, >> 0.328547, 0.382461, 0.295185, 0.365181, 0.314592, 0.471984, 0.491484, >> 0.436928, 0.304527, 0.468701, 0.331218, 0.295958, 0.235148, 0.4964, >> 0.499033, 0.176614, 0.491693, 0.365787, 0.31695, 0.315883, 0.154305, >> 0.455647, 0.455647, 0.262889, 0.49937, 0.476075, 0.203988, 0.236954, >> 0.213507, 0.319337, 0.405514, 0.42953, 0.367161, 0.272004, 0.351335, >> 0.475147, 0.494797, 0.223678, 0.2721, 0.20887, 0.214945, 0.339946, >> 0.290841, 0.247228, 0.232593, 0.346892, 0.284359, 0.297919, 0.288237, >> 0.319685, 0.343188, 0.317151, 0.739096) >> print(signif(cbind(Mean, Std.dev), 2)) >> >> which looks like: >> >>> print(signif(cbind(Mean, Std.dev), 2)) >> Mean Std.dev >> [1,] 0.3100.46 >> [2,] 0.1900.39 >> [3,] 45.000 16.00 >> [4,] 0.5100.50 >> [5,] 0.4900.50 >> [6,] 0.7000.46 >> [7,] 0.3000.46 >> [8,] 0.8000.40 >> [9,] 0.2000.40 >> [10,] 0.6600.47 >> [11,] 0.3400.47 >> [12,] 0.7300.45 >> [13,] 0.2700.45 >> [14,] 0.6400.48 >> [15,] 0.3600.48 >> [16,] 0.9100.28 >> [17,] 0.0890.28 >> [18,] 0.5200.50 >> [19,] 0.4800.50 >> [20,] 0.5500.50 >> [21,] 0.4500.50 >> [22,] 0.9100.28 >> [23,] 0.0860.28 >> [24,] 0.8700.33 >> [25,] 0.1300.33 >> [26,] 0.1000.30 >> [27,] 0.6000.49 >> [28,] 0.2900.46 >> [29,] 0.2700.45 >> [30,] 0.3800.48 >> [31,] 0.3500.48 >> [32,] 0.1600.37 >> [33,] 0.1700.38 >> [34,] 0.1200.33 >> [35,] 0.1800.38 >> [36,] 0.0960.30 >> [37,] 0.1600.37 >> [38,] 0.1100.31 >> [39,] 0.3300.47 >> [40,] 0.4100.49 >> [41,] 0.2600.44 >> [42,] 0.1000.30 >> [43,] 0.6700.47 >> [44,] 0.1300.33 >> [45,] 0.0970.30 >> [46,] 0.0590.24 >> [47,] 0.4400.50 >> [48,] 0.4700.50 >> [49,] 0.0320.18 >> [50,] 0.5900.49 >> [51,] 0.1600.37 >> [52,] 0.1100.32 >> [53,] 0.1100.32 >> [54,] 0.0240.15 >> [55,] 0.7100.46 >> [56,] 0.2900.46 >> [57,] 0.0750.26 >> [58,] 0.4700.50 >> [59,] 0.3500.48 >> [60,] 0.0440.20 >> [61,] 0.0600.24 >> [62,] 0.0480.21 >> [63,] 0.1200.32 >> [64,] 0.2100.41 >> [65,] 0.2400.43 >> [66,] 0.1600.37 >> [67,] 0.0800.27 >> [68,] 0.1400.35 >> [69,] 0.3400.48 >> [70,] 0.4300.49 >> [71,] 0.0530.22 >> [72,] 0.0810.27 >> [73,] 0.0460.21 >> [74,] 0.0490.21 >> [75,] 0.1300.34 >> [76,] 0.0930.29 >> [77,] 0.0650.25 >> [78,] 0.0570.23 >> [79,] 0.1400.35 >> [80,] 0.0890.28 >> [81,] 0.0980.30 >> [82,] 0.0910.2
Re: [R] Format printing with R
Thanks to all, but no, signif() did not work: > print(signif(cbind(Mean,Std.dev),digits=2)) Mean Std.dev [1,] 0.310 0.46 [2,] 0.190 0.39 [3,] 45.000 16.00 [4,] 0.510 0.50 [5,] 0.490 0.50 [6,] 0.700 0.46 On 11/22/2022 5:41 AM, Andrew Simmons wrote: For print(), digits is the minimal number of significant digits. In your case, rounding the first column to the 3rd decimal place gives at least 2 sigfigs and rounding the second column to the 2nd decimal place. If you want to print all numbers to two significant digits, regardless of what other numbers are in the column, use signif() before print(): Mean <- c(0.3107966, 0.1880302, 45.3185794, 0.506637, 0.493363, 0.702915, 0.297085, 0.7967066, 0.2032934, 0.6582301, 0.3417699, 0.7262913, 0.2737087, 0.6415484, 0.3584516, 0.9110264, 0.0889736, 0.5211453, 0.4788547, 0.5481055, 0.4518945, 0.913509, 0.086491, 0.8727269, 0.1272731, 0.1015717, 0.6043692, 0.2940592, 0.2735274, 0.3777426, 0.34873, 0.1603127, 0.1723783, 0.1230961, 0.1779381, 0.0964334, 0.1584698, 0.1113717, 0.3349813, 0.4081109, 0.2569078, 0.1034356, 0.6741233, 0.1254412, 0.096, 0.0587457, 0.4401115, 0.4689114, 0.0322313, 0.5907618, 0.1591195, 0.1132923, 0.1124207, 0.0244058, 0.7058787, 0.2941213, 0.0746892, 0.474911, 0.3471837, 0.0435036, 0.0597126, 0.0478775, 0.1152615, 0.2074968, 0.2440626, 0.1605995, 0.0804598, 0.1442422, 0.3443231, 0.428056, 0.0528221, 0.0805222, 0.0457169, 0.0485596, 0.1333443, 0.0932917, 0.0653987, 0.0573934, 0.1399086, 0.0887337, 0.0984479, 0.0914421, 0.1155505, 0.1363764, 0.113457, 1.2985286) Std.dev <- c(0.46282, 0.390736, 16.313635, 0.499956, 0.499956, 0.456974, 0.456974, 0.402449, 0.402449, 0.474303, 0.474303, 0.445861, 0.445861, 0.479546, 0.479546, 0.284706, 0.284706, 0.499553, 0.499553, 0.49768, 0.49768, 0.281088, 0.281088, 0.333279, 0.333279, 0.302084, 0.488986, 0.455619, 0.445769, 0.484823, 0.476568, 0.366896, 0.377709, 0.328547, 0.382461, 0.295185, 0.365181, 0.314592, 0.471984, 0.491484, 0.436928, 0.304527, 0.468701, 0.331218, 0.295958, 0.235148, 0.4964, 0.499033, 0.176614, 0.491693, 0.365787, 0.31695, 0.315883, 0.154305, 0.455647, 0.455647, 0.262889, 0.49937, 0.476075, 0.203988, 0.236954, 0.213507, 0.319337, 0.405514, 0.42953, 0.367161, 0.272004, 0.351335, 0.475147, 0.494797, 0.223678, 0.2721, 0.20887, 0.214945, 0.339946, 0.290841, 0.247228, 0.232593, 0.346892, 0.284359, 0.297919, 0.288237, 0.319685, 0.343188, 0.317151, 0.739096) print(signif(cbind(Mean, Std.dev), 2)) which looks like: print(signif(cbind(Mean, Std.dev), 2)) Mean Std.dev [1,] 0.3100.46 [2,] 0.1900.39 [3,] 45.000 16.00 [4,] 0.5100.50 [5,] 0.4900.50 [6,] 0.7000.46 [7,] 0.3000.46 [8,] 0.8000.40 [9,] 0.2000.40 [10,] 0.6600.47 [11,] 0.3400.47 [12,] 0.7300.45 [13,] 0.2700.45 [14,] 0.6400.48 [15,] 0.3600.48 [16,] 0.9100.28 [17,] 0.0890.28 [18,] 0.5200.50 [19,] 0.4800.50 [20,] 0.5500.50 [21,] 0.4500.50 [22,] 0.9100.28 [23,] 0.0860.28 [24,] 0.8700.33 [25,] 0.1300.33 [26,] 0.1000.30 [27,] 0.6000.49 [28,] 0.2900.46 [29,] 0.2700.45 [30,] 0.3800.48 [31,] 0.3500.48 [32,] 0.1600.37 [33,] 0.1700.38 [34,] 0.1200.33 [35,] 0.1800.38 [36,] 0.0960.30 [37,] 0.1600.37 [38,] 0.1100.31 [39,] 0.3300.47 [40,] 0.4100.49 [41,] 0.2600.44 [42,] 0.1000.30 [43,] 0.6700.47 [44,] 0.1300.33 [45,] 0.0970.30 [46,] 0.0590.24 [47,] 0.4400.50 [48,] 0.4700.50 [49,] 0.0320.18 [50,] 0.5900.49 [51,] 0.1600.37 [52,] 0.1100.32 [53,] 0.1100.32 [54,] 0.0240.15 [55,] 0.7100.46 [56,] 0.2900.46 [57,] 0.0750.26 [58,] 0.4700.50 [59,] 0.3500.48 [60,] 0.0440.20 [61,] 0.0600.24 [62,] 0.0480.21 [63,] 0.1200.32 [64,] 0.2100.41 [65,] 0.2400.43 [66,] 0.1600.37 [67,] 0.0800.27 [68,] 0.1400.35 [69,] 0.3400.48 [70,] 0.4300.49 [71,] 0.0530.22 [72,] 0.0810.27 [73,] 0.0460.21 [74,] 0.0490.21 [75,] 0.1300.34 [76,] 0.0930.29 [77,] 0.0650.25 [78,] 0.0570.23 [79,] 0.1400.35 [80,] 0.0890.28 [81,] 0.0980.30 [82,] 0.0910.29 [83,] 0.1200.32 [84,] 0.1400.34 [85,] 0.1100.32 [86,] 1.3000.74 R will still print 3 decimal places for the third column since it wants them to be of the same format, but each number is 2 sigfigs. On Mon, Nov 21, 2022 at 3:41 PM Steven T. Yen via R-help 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.310796
Re: [R] Format printing with R
Hi All How about data.frame or zapsmall. Apologies for the small set but it seems to show the point Mean = c(0.311,0.188,45.319) sdd = c(0.36,0.39,16.31) data.frame(Mean = Mean, St.dev = sdd) Mean St.dev 1 0.311 0.36 2 0.188 0.39 3 45.319 16.31 print(data.frame(Mean = Mean, St.dev = sdd),digits = 2) Mean St.dev 1 0.31 0.36 2 0.19 0.39 3 45.32 16.31 zapsmall(data.frame(Mean = Mean, St.dev = sdd),digits = 4) Mean St.dev 1 0.31 0.36 2 0.19 0.39 3 45.32 16.31 zapsmall(cbind(Mean = Mean,sdd),digits = 4) Mean sdd [1,] 0.31 0.36 [2,] 0.19 0.39 [3,] 45.32 16.31 Regards Duncan Mackay -- Original Message -- From: "Jim Lemon" To: "Steven T. Yen" Cc: "R-help Mailing List" Sent: Tuesday, 22 Nov, 2022 At 8:09 AM Subject: Re: [R] Format printing with R 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.310.46 [2,] 0.190.39 [3,] 45.32 16.31 [4,] 0.510.50 [5,] 0.490.50 [6,] 0.700.46 [7,] 0.300.46 [8,] 0.800.40 [9,] 0.200.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 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.096 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.3110.46 [2,] 0.1880.39 [3,] 45.319 16.31 [4,] 0.5070.50 [5,] 0.4930.50 [6,] 0.7030.46 [7,] 0.2970.46 [8,] 0.7970.40 [9,] 0.2030.40 [10,] 0.6580.47 [11,] 0.3420.47 [12,] 0.7260.45 [13,] 0.2740.45 [14,] 0.6420.48 [15,] 0.3580.48 [16,] 0.9110.28 [17,] 0.0890.28 [18,] 0.5210.50 [19,] 0.4790.50 [20,] 0.5480.50 [21,] 0.4520.50 [22,] 0.9140.28 [23,] 0.0860.28 [24,] 0.8730.33 [25,] 0.1270.33 [26,] 0.1020.30 [27,] 0.6040.49 [28,] 0.2940.46 [29,] 0.2740.45 [30,] 0.3780.48 [31,] 0.3490.48 [32,] 0.160
Re: [R] make install libgfortran.so.5: cannot open shared object file: No such file or directory; conftest.c:1:10: fatal error: jni.h: No such file or directory
> В Mon, 21 Nov 2022 10:19:36 -0500 > Rob Kudyba пишет: > > > I edited the last line to be: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64 then > > make install errored with: > > /path/to/R-4.2.2/bin/exec/R: error while loading shared libraries: > > libpcre2-8.so.0: cannot open shared object file: No such file or > > directory > > > > So it appears that the same issue happens for PCRE! I then edited the > > line to be: > > export > > > LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64:/path/to/pcre2-10.35/lib > > > > Then make install finished with: > > Successfully remade target file `install'. > > Does the installed copy of R work? > Yes Are you running make install as root? Programs starting as root are wary > of environment variables such as LD_LIBRARY_PATH and may ignore or > unset them while starting up (otherwise it would be trivial to load user > code into setuid root binaries and take over the system). You may have > to load the module again after you obtain the superuser privileges. > Ah I should've mentioned this. I did use sudo to install as the program modules are shared and installed by root. That has to be the reason. > "R Installation and Administration" [1] says that the R build process > remembers the library paths to put into LD_LIBRARY_PATH, but only if > they are specified in the LDFLAGS parameter, so if there's a set of > library paths that's not expected to be normally present in > LD_LIBRARY_PATH, perhaps it's best to mention them explicitly in the > ./configure call. > > -- > Best regards, > Ivan > > [1] https://cran.r-project.org/doc/manuals/R-admin.html What would the ./configure options look like? [[alternative HTML version deleted]] __ 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.
Re: [R] make install libgfortran.so.5: cannot open shared object file: No such file or directory; conftest.c:1:10: fatal error: jni.h: No such file or directory
On Sun, Nov 20, 2022 at 2:26 PM Ivan Krylov wrote: > On Sun, 20 Nov 2022 14:03:34 -0500 > Rob Kudyba wrote: > > > /path/to/gcc-11.2/lib is definitely in LD_LIBRARY_PATH when loading > > the GCC 11.2 module. > > > > If using the /path/to/R-4.2.2/etc/ldpaths where would I put the > > correct path? I would've hoped the configure/make process would've > > found this automatically. > > Interesting that bin/R works but calling bin/R from what amounts to > `make -C src/library install` doesn't. I think that the failing step is > the following command: > > @$(ECHO) " building HTML index ..." > @$(ECHO) "utils:::make.packages.html(.Library, verbose=FALSE, > docdir=\"$(DESTDIR)${rdocdir}\")" | \ > R_DEFAULT_PACKAGES=NULL LC_ALL=C ${R_EXE} >/dev/null > > I don't see a reason for Make to lose the LD_LIBRARY_PATH when > launching R like this. > > Can you see the failing step in the `make -d install` output? There > will be a lot of text, most of it unrelated, unfortunately. > I've uploaded the output to https://easyupload.io/scuujn The gcc-related part has this: Considering target file `install-main'. File `install-main' does not exist. Considering target file `install-Rscript'. File `install-Rscript' does not exist. Finished prerequisites of target file `install-Rscript'. Must remake target `install-Rscript'. Invoking recipe from Makefile:71 to update target `install-Rscript'. make[2]: Entering directory `/path/to/me/R-4.2.2/src/unix' gcc -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H-g -O2 -L/usr/local/lib64 -DR_HOME='"/path/to/R-4.2/lib64/R"' \ -o Rscript ./Rscript.c Putting child 0x65bc00 (install-Rscript) PID 240122 on the chain. Live child 0x65bc00 (install-Rscript) PID 240122 If something loses the LD_LIBRARY_PATH environment variable on the way > from Make to R, hard-coding it in etc/ldpaths should work around the > problem, but it may be hard to find out what went wrong. > I edited the last line to be: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64 then make install errored with: /path/to/R-4.2.2/bin/exec/R: error while loading shared libraries: libpcre2-8.so.0: cannot open shared object file: No such file or directory So it appears that the same issue happens for PCRE! I then edited the line to be: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64:/path/to/pcre2-10.35/lib Then make install finished with: Successfully remade target file `install'. > > If you run `mkfifo /tmp/1` and insert `read foo etc/ldpaths, it should hang until you write something into /tmp/1. > Using this, it should be possible to inspect /proc/${pid}/environ for > the whole process tree from the parent Make process to the shell that's > about to launch R. Can you find the first process that lacks the proper > LD_LIBRARY_PATH environment variable? > I ran the 1st command and then added the 'read' to the file. I'm not following what should've happened? I didn't need to include the back ticks,`, in the file, correct? Perhaps the debug from make install will provide you more info? Would this be considered a bug or enhancement? Thanks for your help on this. Rob [[alternative HTML version deleted]] __ 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.
Re: [R] Format printing with R
For print(), digits is the minimal number of significant digits. In your case, rounding the first column to the 3rd decimal place gives at least 2 sigfigs and rounding the second column to the 2nd decimal place. If you want to print all numbers to two significant digits, regardless of what other numbers are in the column, use signif() before print(): Mean <- c(0.3107966, 0.1880302, 45.3185794, 0.506637, 0.493363, 0.702915, 0.297085, 0.7967066, 0.2032934, 0.6582301, 0.3417699, 0.7262913, 0.2737087, 0.6415484, 0.3584516, 0.9110264, 0.0889736, 0.5211453, 0.4788547, 0.5481055, 0.4518945, 0.913509, 0.086491, 0.8727269, 0.1272731, 0.1015717, 0.6043692, 0.2940592, 0.2735274, 0.3777426, 0.34873, 0.1603127, 0.1723783, 0.1230961, 0.1779381, 0.0964334, 0.1584698, 0.1113717, 0.3349813, 0.4081109, 0.2569078, 0.1034356, 0.6741233, 0.1254412, 0.096, 0.0587457, 0.4401115, 0.4689114, 0.0322313, 0.5907618, 0.1591195, 0.1132923, 0.1124207, 0.0244058, 0.7058787, 0.2941213, 0.0746892, 0.474911, 0.3471837, 0.0435036, 0.0597126, 0.0478775, 0.1152615, 0.2074968, 0.2440626, 0.1605995, 0.0804598, 0.1442422, 0.3443231, 0.428056, 0.0528221, 0.0805222, 0.0457169, 0.0485596, 0.1333443, 0.0932917, 0.0653987, 0.0573934, 0.1399086, 0.0887337, 0.0984479, 0.0914421, 0.1155505, 0.1363764, 0.113457, 1.2985286) Std.dev <- c(0.46282, 0.390736, 16.313635, 0.499956, 0.499956, 0.456974, 0.456974, 0.402449, 0.402449, 0.474303, 0.474303, 0.445861, 0.445861, 0.479546, 0.479546, 0.284706, 0.284706, 0.499553, 0.499553, 0.49768, 0.49768, 0.281088, 0.281088, 0.333279, 0.333279, 0.302084, 0.488986, 0.455619, 0.445769, 0.484823, 0.476568, 0.366896, 0.377709, 0.328547, 0.382461, 0.295185, 0.365181, 0.314592, 0.471984, 0.491484, 0.436928, 0.304527, 0.468701, 0.331218, 0.295958, 0.235148, 0.4964, 0.499033, 0.176614, 0.491693, 0.365787, 0.31695, 0.315883, 0.154305, 0.455647, 0.455647, 0.262889, 0.49937, 0.476075, 0.203988, 0.236954, 0.213507, 0.319337, 0.405514, 0.42953, 0.367161, 0.272004, 0.351335, 0.475147, 0.494797, 0.223678, 0.2721, 0.20887, 0.214945, 0.339946, 0.290841, 0.247228, 0.232593, 0.346892, 0.284359, 0.297919, 0.288237, 0.319685, 0.343188, 0.317151, 0.739096) print(signif(cbind(Mean, Std.dev), 2)) which looks like: > print(signif(cbind(Mean, Std.dev), 2)) Mean Std.dev [1,] 0.3100.46 [2,] 0.1900.39 [3,] 45.000 16.00 [4,] 0.5100.50 [5,] 0.4900.50 [6,] 0.7000.46 [7,] 0.3000.46 [8,] 0.8000.40 [9,] 0.2000.40 [10,] 0.6600.47 [11,] 0.3400.47 [12,] 0.7300.45 [13,] 0.2700.45 [14,] 0.6400.48 [15,] 0.3600.48 [16,] 0.9100.28 [17,] 0.0890.28 [18,] 0.5200.50 [19,] 0.4800.50 [20,] 0.5500.50 [21,] 0.4500.50 [22,] 0.9100.28 [23,] 0.0860.28 [24,] 0.8700.33 [25,] 0.1300.33 [26,] 0.1000.30 [27,] 0.6000.49 [28,] 0.2900.46 [29,] 0.2700.45 [30,] 0.3800.48 [31,] 0.3500.48 [32,] 0.1600.37 [33,] 0.1700.38 [34,] 0.1200.33 [35,] 0.1800.38 [36,] 0.0960.30 [37,] 0.1600.37 [38,] 0.1100.31 [39,] 0.3300.47 [40,] 0.4100.49 [41,] 0.2600.44 [42,] 0.1000.30 [43,] 0.6700.47 [44,] 0.1300.33 [45,] 0.0970.30 [46,] 0.0590.24 [47,] 0.4400.50 [48,] 0.4700.50 [49,] 0.0320.18 [50,] 0.5900.49 [51,] 0.1600.37 [52,] 0.1100.32 [53,] 0.1100.32 [54,] 0.0240.15 [55,] 0.7100.46 [56,] 0.2900.46 [57,] 0.0750.26 [58,] 0.4700.50 [59,] 0.3500.48 [60,] 0.0440.20 [61,] 0.0600.24 [62,] 0.0480.21 [63,] 0.1200.32 [64,] 0.2100.41 [65,] 0.2400.43 [66,] 0.1600.37 [67,] 0.0800.27 [68,] 0.1400.35 [69,] 0.3400.48 [70,] 0.4300.49 [71,] 0.0530.22 [72,] 0.0810.27 [73,] 0.0460.21 [74,] 0.0490.21 [75,] 0.1300.34 [76,] 0.0930.29 [77,] 0.0650.25 [78,] 0.0570.23 [79,] 0.1400.35 [80,] 0.0890.28 [81,] 0.0980.30 [82,] 0.0910.29 [83,] 0.1200.32 [84,] 0.1400.34 [85,] 0.1100.32 [86,] 1.3000.74 > R will still print 3 decimal places for the third column since it wants them to be of the same format, but each number is 2 sigfigs. On Mon, Nov 21, 2022 at 3:41 PM Steven T. Yen via R-help 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
Re: [R] Format printing with R
For better reproducibility, use dput to share data. A matrix and a data frame look similar, but they can act differently. On November 21, 2022 1:09:55 PM PST, Jim Lemon wrote: >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.310.46 >[2,] 0.190.39 >[3,] 45.32 16.31 >[4,] 0.510.50 >[5,] 0.490.50 >[6,] 0.700.46 >[7,] 0.300.46 >[8,] 0.800.40 >[9,] 0.200.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 > 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.096 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.3110.46 >> [2,] 0.1880.39 >> [3,] 45.319 16.31 >> [4,] 0.5070.50 >> [5,] 0.4930.50 >> [6,] 0.7030.46 >> [7,] 0.2970.46 >> [8,] 0.7970.40 >> [9,] 0.2030.40 >> [10,] 0.6580.47 >> [11,] 0.3420.47 >> [12,] 0.7260.45 >> [13,] 0.2740.45 >> [14,] 0.6420.48 >> [15,] 0.3580.48 >> [16,] 0.9110.28 >> [17,] 0.0890.28 >> [18,] 0.5210.50 >> [19,] 0.4790.50 >> [20,] 0.5480.50 >> [21,] 0.4520.50 >> [22,] 0.9140.28 >> [23,] 0.0860.28 >> [24,] 0.8730.33 >> [25,] 0.1270.33 >> [26,] 0.1020.30 >> [27,] 0.6040.49 >> [28,] 0.2940.46 >> [29,] 0.2740.45 >> [30,] 0.3780.48 >> [31,] 0.3490.48 >> [32,] 0.1600.37 >> [33,] 0.1720.38 >> [34,] 0.1230.33 >> [35,] 0.1780.38 >> [36,] 0.0960.30 >> [37,] 0.1580.37 >> [38,] 0.1110.31 >> [39,] 0.3350.47 >> [40,] 0.4080.49 >> [41,] 0.257
Re: [R] Format printing with R
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.310.46 [2,] 0.190.39 [3,] 45.32 16.31 [4,] 0.510.50 [5,] 0.490.50 [6,] 0.700.46 [7,] 0.300.46 [8,] 0.800.40 [9,] 0.200.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 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.096 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.3110.46 > [2,] 0.1880.39 > [3,] 45.319 16.31 > [4,] 0.5070.50 > [5,] 0.4930.50 > [6,] 0.7030.46 > [7,] 0.2970.46 > [8,] 0.7970.40 > [9,] 0.2030.40 > [10,] 0.6580.47 > [11,] 0.3420.47 > [12,] 0.7260.45 > [13,] 0.2740.45 > [14,] 0.6420.48 > [15,] 0.3580.48 > [16,] 0.9110.28 > [17,] 0.0890.28 > [18,] 0.5210.50 > [19,] 0.4790.50 > [20,] 0.5480.50 > [21,] 0.4520.50 > [22,] 0.9140.28 > [23,] 0.0860.28 > [24,] 0.8730.33 > [25,] 0.1270.33 > [26,] 0.1020.30 > [27,] 0.6040.49 > [28,] 0.2940.46 > [29,] 0.2740.45 > [30,] 0.3780.48 > [31,] 0.3490.48 > [32,] 0.1600.37 > [33,] 0.1720.38 > [34,] 0.1230.33 > [35,] 0.1780.38 > [36,] 0.0960.30 > [37,] 0.1580.37 > [38,] 0.1110.31 > [39,] 0.3350.47 > [40,] 0.4080.49 > [41,] 0.2570.44 > [42,] 0.1030.30 > [43,] 0.6740.47 > [44,] 0.1250.33 > [45,] 0.0970.30 > [46,] 0.0590.24 > [47,] 0.4400.50 > [48,] 0.4690.50 > [49,] 0.0320.18 > [50,] 0.5910.49 > [51,] 0.1590.37 > [52,] 0.1130.32 > [53,] 0.1120.32 > [54,] 0.0240.15 > [55,] 0.7060.46 > [56,] 0.2940.46
[R] Format printing with R
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.096 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.
Re: [R] IGCI implemented in R package ?
Hi Sacha, My search turned up the Causal Discovery Toolbox which includes IGCI among 10 (or more) methods. This site includes both Python and R resources and seems to be quite rich - hopefully you will find something useful. Here's the link: https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html HTH, Eric On Mon, Nov 21, 2022 at 9:00 PM varin sacha via R-help wrote: > Dear R experts, > > Google is very often my friend but this time it does not ! > Are you aware of an R package in which the directed causal discovery > algorithm called the Information Geometric Causal Inference (IGCI) of > (Daniusis et al., 2010) is implemented ? > > Best, > Sacha > > Envoyé de mon iPhone > __ > 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. > [[alternative HTML version deleted]] __ 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] IGCI implemented in R package ?
Dear R experts, Google is very often my friend but this time it does not ! Are you aware of an R package in which the directed causal discovery algorithm called the Information Geometric Causal Inference (IGCI) of (Daniusis et al., 2010) is implemented ? Best, Sacha Envoyé de mon iPhone __ 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.
Re: [R] linux, emacs, R on iPhone/iPad
Hi Dr. H: I tried this a couple of months ago on my iPad. Everything would load, but when I tried to run R, it would never open. However, my iPad is about 6 years old. Do you need a particular model for the iPad, please? Thanks Erin On Mon, Nov 21, 2022 at 11:03 AM Richard M. Heiberger wrote: > I discovered that the "iSH shell" is available for the iPhone/iPad from > the Applications app. > this is Alpine linux > Once iSH is loaded from the App store, then open it to a shell and download > > apk add emacs > apk add R > > emacs works well for writing files and sending them to a bigger computer > by airdrop or email etc. > This is the real Emacs, not the "Not Emacs" app. > The emacs uses a variant of the iPhone keyboard augmented with tab, > control, escape, arrows keys > and allows swiping for typing. > > R works sometimes in the linux shell outside emacs, but not yet from the > emacs *shell*. > I haven't figures out how to download ESS. > > iSH's help page for R > > https://github.com/ish-app/ish/wiki/Installing-R-and-any-package-from-the-CRAN > gives a long docker-related way of getting arbitrary packages to work. > > Is there interest in forming R-sig-iOS and CRAN support for an iOS binary > repository? > > Rich > __ > 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. > -- Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com [[alternative HTML version deleted]] __ 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] linux, emacs, R on iPhone/iPad
I discovered that the "iSH shell" is available for the iPhone/iPad from the Applications app. this is Alpine linux Once iSH is loaded from the App store, then open it to a shell and download apk add emacs apk add R emacs works well for writing files and sending them to a bigger computer by airdrop or email etc. This is the real Emacs, not the "Not Emacs" app. The emacs uses a variant of the iPhone keyboard augmented with tab, control, escape, arrows keys and allows swiping for typing. R works sometimes in the linux shell outside emacs, but not yet from the emacs *shell*. I haven't figures out how to download ESS. iSH's help page for R https://github.com/ish-app/ish/wiki/Installing-R-and-any-package-from-the-CRAN gives a long docker-related way of getting arbitrary packages to work. Is there interest in forming R-sig-iOS and CRAN support for an iOS binary repository? Rich __ 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.
Re: [R] make install libgfortran.so.5: cannot open shared object file: No such file or directory; conftest.c:1:10: fatal error: jni.h: No such file or directory
В Mon, 21 Nov 2022 10:19:36 -0500 Rob Kudyba пишет: > I edited the last line to be: > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64 then > make install errored with: > /path/to/R-4.2.2/bin/exec/R: error while loading shared libraries: > libpcre2-8.so.0: cannot open shared object file: No such file or > directory > > So it appears that the same issue happens for PCRE! I then edited the > line to be: > export > LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64:/path/to/pcre2-10.35/lib > > Then make install finished with: > Successfully remade target file `install'. Does the installed copy of R work? Are you running make install as root? Programs starting as root are wary of environment variables such as LD_LIBRARY_PATH and may ignore or unset them while starting up (otherwise it would be trivial to load user code into setuid root binaries and take over the system). You may have to load the module again after you obtain the superuser privileges. > I ran the 1st command and then added the 'read' to the file. I'm not > following what should've happened? I didn't need to include the back > ticks,`, in the file, correct? Yes, I meant to omit the backticks. What I'm suggesting to perform is Linux process debugging: 1) Make etc/ldpaths hang just before R is (unsuccessfully) launched by adding an I/O operation that you can control. 2) While make install -> (lots of child processes) -> bin/R is hung, run `top`, `htop`, or any other process manager to have a look at the process tree. There should be your shell process, the Make process, and a number of child shell processes. The grand-(grand-...)child should be sleeping in I/O. 3) Using either your process manager or the command https://cran.r-project.org/doc/manuals/R-admin.html __ 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.