/usr/share/R/doc/manual/R-FAQ.html is in r-doc-html 3.4.4-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>R FAQ</title>
<meta name="description" content="R FAQ">
<meta name="keywords" content="R FAQ">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2any">
<link href="#Top" rel="start" title="Top">
<link href="#SEC_Contents" rel="contents" title="Table of Contents">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
body {
margin-left: 5%;
margin-right: 5%;
}
h1 {
background: white;
color: rgb(25%, 25%, 25%);
font-family: monospace;
font-size: xx-large;
text-align: center;
}
h2 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
font-size: x-large;
text-align: center;
}
h3 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
font-size: large;
}
h4 {
background: white;
color: rgb(40%, 40%, 40%);
font-family: monospace;
}
span.samp {
font-family: monospace;
}
span.command {
font-family: monospace;
}
span.option {
font-family: monospace;
}
span.file {
font-family: monospace;
}
span.env {
font-family: monospace;
}
ul.menu {
list-style-type: decimal;
}
-->
</style>
</head>
<body lang="en">
<h1 class="settitle" align="center">R FAQ</h1>
<h2>Frequently Asked Questions on R</h2>
<h3 style="text-align: center;">Version 2016-06-06</h3>
<h3 style="text-align: center;">Kurt Hornik</h3>
<hr>
<a name="SEC_Contents"></a>
<h2 class="contents-heading">Table of Contents</h2>
<div class="contents">
<ul class="no-bullet">
<li><a name="toc-Introduction-1" href="#Introduction">1 Introduction</a>
<ul class="no-bullet">
<li><a name="toc-Legalese-1" href="#Legalese">1.1 Legalese</a></li>
<li><a name="toc-Obtaining-this-document-1" href="#Obtaining-this-document">1.2 Obtaining this document</a></li>
<li><a name="toc-Citing-this-document-1" href="#Citing-this-document">1.3 Citing this document</a></li>
<li><a name="toc-Notation-1" href="#Notation">1.4 Notation</a></li>
<li><a name="toc-Feedback-1" href="#Feedback">1.5 Feedback</a></li>
</ul></li>
<li><a name="toc-R-Basics-1" href="#R-Basics">2 R Basics</a>
<ul class="no-bullet">
<li><a name="toc-What-is-R_003f-1" href="#What-is-R_003f">2.1 What is R?</a></li>
<li><a name="toc-What-machines-does-R-run-on_003f-1" href="#What-machines-does-R-run-on_003f">2.2 What machines does R run on?</a></li>
<li><a name="toc-What-is-the-current-version-of-R_003f-1" href="#What-is-the-current-version-of-R_003f">2.3 What is the current version of R?</a></li>
<li><a name="toc-How-can-R-be-obtained_003f-1" href="#How-can-R-be-obtained_003f">2.4 How can R be obtained?</a></li>
<li><a name="toc-How-can-R-be-installed_003f-1" href="#How-can-R-be-installed_003f">2.5 How can R be installed?</a>
<ul class="no-bullet">
<li><a name="toc-How-can-R-be-installed-_0028Unix_002dlike_0029-1" href="#How-can-R-be-installed-_0028Unix_002dlike_0029">2.5.1 How can R be installed (Unix-like)</a></li>
<li><a name="toc-How-can-R-be-installed-_0028Windows_0029-1" href="#How-can-R-be-installed-_0028Windows_0029">2.5.2 How can R be installed (Windows)</a></li>
<li><a name="toc-How-can-R-be-installed-_0028Mac_0029-1" href="#How-can-R-be-installed-_0028Mac_0029">2.5.3 How can R be installed (Mac)</a></li>
</ul></li>
<li><a name="toc-Are-there-Unix_002dlike-binaries-for-R_003f-1" href="#Are-there-Unix_002dlike-binaries-for-R_003f">2.6 Are there Unix-like binaries for R?</a></li>
<li><a name="toc-What-documentation-exists-for-R_003f-1" href="#What-documentation-exists-for-R_003f">2.7 What documentation exists for R?</a></li>
<li><a name="toc-Citing-R-1" href="#Citing-R">2.8 Citing R</a></li>
<li><a name="toc-What-mailing-lists-exist-for-R_003f-1" href="#What-mailing-lists-exist-for-R_003f">2.9 What mailing lists exist for R?</a></li>
<li><a name="toc-What-is-CRAN_003f-1" href="#What-is-CRAN_003f">2.10 What is <acronym>CRAN</acronym>?</a></li>
<li><a name="toc-Can-I-use-R-for-commercial-purposes_003f-1" href="#Can-I-use-R-for-commercial-purposes_003f">2.11 Can I use R for commercial purposes?</a></li>
<li><a name="toc-Why-is-R-named-R_003f-1" href="#Why-is-R-named-R_003f">2.12 Why is R named R?</a></li>
<li><a name="toc-What-is-the-R-Foundation_003f-1" href="#What-is-the-R-Foundation_003f">2.13 What is the R Foundation?</a></li>
<li><a name="toc-What-is-R_002dForge_003f-1" href="#What-is-R_002dForge_003f">2.14 What is R-Forge?</a></li>
</ul></li>
<li><a name="toc-R-and-S-1" href="#R-and-S">3 R and S</a>
<ul class="no-bullet">
<li><a name="toc-What-is-S_003f-1" href="#What-is-S_003f">3.1 What is S?</a></li>
<li><a name="toc-What-is-S_002dPLUS_003f-1" href="#What-is-S_002dPLUS_003f">3.2 What is <small>S-PLUS</small>?</a></li>
<li><a name="toc-What-are-the-differences-between-R-and-S_003f-1" href="#What-are-the-differences-between-R-and-S_003f">3.3 What are the differences between R and S?</a>
<ul class="no-bullet">
<li><a name="toc-Lexical-scoping-1" href="#Lexical-scoping">3.3.1 Lexical scoping</a></li>
<li><a name="toc-Models-1" href="#Models">3.3.2 Models</a></li>
<li><a name="toc-Others-1" href="#Others">3.3.3 Others</a></li>
</ul></li>
<li><a name="toc-Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f-1" href="#Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f">3.4 Is there anything R can do that <small>S-PLUS</small> cannot?</a></li>
<li><a name="toc-What-is-R_002dplus_003f-1" href="#What-is-R_002dplus_003f">3.5 What is R-plus?</a></li>
</ul></li>
<li><a name="toc-R-Web-Interfaces-1" href="#R-Web-Interfaces">4 R Web Interfaces</a></li>
<li><a name="toc-R-Add_002dOn-Packages-1" href="#R-Add_002dOn-Packages">5 R Add-On Packages</a>
<ul class="no-bullet">
<li><a name="toc-Which-add_002don-packages-exist-for-R_003f-1" href="#Which-add_002don-packages-exist-for-R_003f">5.1 Which add-on packages exist for R?</a>
<ul class="no-bullet">
<li><a name="toc-Add_002don-packages-in-R-1" href="#Add_002don-packages-in-R">5.1.1 Add-on packages in R</a></li>
<li><a name="toc-Add_002don-packages-from-CRAN-1" href="#Add_002don-packages-from-CRAN">5.1.2 Add-on packages from <acronym>CRAN</acronym></a></li>
<li><a name="toc-Add_002don-packages-from-Omegahat-1" href="#Add_002don-packages-from-Omegahat">5.1.3 Add-on packages from Omegahat</a></li>
<li><a name="toc-Add_002don-packages-from-Bioconductor-1" href="#Add_002don-packages-from-Bioconductor">5.1.4 Add-on packages from Bioconductor</a></li>
<li><a name="toc-Other-add_002don-packages-1" href="#Other-add_002don-packages">5.1.5 Other add-on packages</a></li>
</ul></li>
<li><a name="toc-How-can-add_002don-packages-be-installed_003f-1" href="#How-can-add_002don-packages-be-installed_003f">5.2 How can add-on packages be installed?</a></li>
<li><a name="toc-How-can-add_002don-packages-be-used_003f-1" href="#How-can-add_002don-packages-be-used_003f">5.3 How can add-on packages be used?</a></li>
<li><a name="toc-How-can-add_002don-packages-be-removed_003f-1" href="#How-can-add_002don-packages-be-removed_003f">5.4 How can add-on packages be removed?</a></li>
<li><a name="toc-How-can-I-create-an-R-package_003f-1" href="#How-can-I-create-an-R-package_003f">5.5 How can I create an R package?</a></li>
<li><a name="toc-How-can-I-contribute-to-R_003f-1" href="#How-can-I-contribute-to-R_003f">5.6 How can I contribute to R?</a></li>
</ul></li>
<li><a name="toc-R-and-Emacs-1" href="#R-and-Emacs">6 R and Emacs</a>
<ul class="no-bullet">
<li><a name="toc-Is-there-Emacs-support-for-R_003f-1" href="#Is-there-Emacs-support-for-R_003f">6.1 Is there Emacs support for R?</a></li>
<li><a name="toc-Should-I-run-R-from-within-Emacs_003f-1" href="#Should-I-run-R-from-within-Emacs_003f">6.2 Should I run R from within Emacs?</a></li>
<li><a name="toc-Debugging-R-from-within-Emacs-1" href="#Debugging-R-from-within-Emacs">6.3 Debugging R from within Emacs</a></li>
</ul></li>
<li><a name="toc-R-Miscellanea-1" href="#R-Miscellanea">7 R Miscellanea</a>
<ul class="no-bullet">
<li><a name="toc-How-can-I-set-components-of-a-list-to-NULL_003f-1" href="#How-can-I-set-components-of-a-list-to-NULL_003f">7.1 How can I set components of a list to NULL?</a></li>
<li><a name="toc-How-can-I-save-my-workspace_003f-1" href="#How-can-I-save-my-workspace_003f">7.2 How can I save my workspace?</a></li>
<li><a name="toc-How-can-I-clean-up-my-workspace_003f-1" href="#How-can-I-clean-up-my-workspace_003f">7.3 How can I clean up my workspace?</a></li>
<li><a name="toc-How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f-1" href="#How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f">7.4 How can I get eval() and D() to work?</a></li>
<li><a name="toc-Why-do-my-matrices-lose-dimensions_003f-1" href="#Why-do-my-matrices-lose-dimensions_003f">7.5 Why do my matrices lose dimensions?</a></li>
<li><a name="toc-How-does-autoloading-work_003f-1" href="#How-does-autoloading-work_003f">7.6 How does autoloading work?</a></li>
<li><a name="toc-How-should-I-set-options_003f-1" href="#How-should-I-set-options_003f">7.7 How should I set options?</a></li>
<li><a name="toc-How-do-file-names-work-in-Windows_003f-1" href="#How-do-file-names-work-in-Windows_003f">7.8 How do file names work in Windows?</a></li>
<li><a name="toc-Why-does-plotting-give-a-color-allocation-error_003f-1" href="#Why-does-plotting-give-a-color-allocation-error_003f">7.9 Why does plotting give a color allocation error?</a></li>
<li><a name="toc-How-do-I-convert-factors-to-numeric_003f-1" href="#How-do-I-convert-factors-to-numeric_003f">7.10 How do I convert factors to numeric?</a></li>
<li><a name="toc-Are-Trellis-displays-implemented-in-R_003f-1" href="#Are-Trellis-displays-implemented-in-R_003f">7.11 Are Trellis displays implemented in R?</a></li>
<li><a name="toc-What-are-the-enclosing-and-parent-environments_003f-1" href="#What-are-the-enclosing-and-parent-environments_003f">7.12 What are the enclosing and parent environments?</a></li>
<li><a name="toc-How-can-I-substitute-into-a-plot-label_003f-1" href="#How-can-I-substitute-into-a-plot-label_003f">7.13 How can I substitute into a plot label?</a></li>
<li><a name="toc-What-are-valid-names_003f-1" href="#What-are-valid-names_003f">7.14 What are valid names?</a></li>
<li><a name="toc-Are-GAMs-implemented-in-R_003f-1" href="#Are-GAMs-implemented-in-R_003f">7.15 Are GAMs implemented in R?</a></li>
<li><a name="toc-Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f-1" href="#Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f">7.16 Why is the output not printed when I source() a file?</a></li>
<li><a name="toc-Why-does-outer_0028_0029-behave-strangely-with-my-function_003f-1" href="#Why-does-outer_0028_0029-behave-strangely-with-my-function_003f">7.17 Why does outer() behave strangely with my function?</a></li>
<li><a name="toc-Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f-1" href="#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f">7.18 Why does the output from anova() depend on the order of factors in the model?</a></li>
<li><a name="toc-How-do-I-produce-PNG-graphics-in-batch-mode_003f-1" href="#How-do-I-produce-PNG-graphics-in-batch-mode_003f">7.19 How do I produce PNG graphics in batch mode?</a></li>
<li><a name="toc-How-can-I-get-command-line-editing-to-work_003f-1" href="#How-can-I-get-command-line-editing-to-work_003f">7.20 How can I get command line editing to work?</a></li>
<li><a name="toc-How-can-I-turn-a-string-into-a-variable_003f-1" href="#How-can-I-turn-a-string-into-a-variable_003f">7.21 How can I turn a string into a variable?</a></li>
<li><a name="toc-Why-do-lattice_002ftrellis-graphics-not-work_003f-1" href="#Why-do-lattice_002ftrellis-graphics-not-work_003f">7.22 Why do lattice/trellis graphics not work?</a></li>
<li><a name="toc-How-can-I-sort-the-rows-of-a-data-frame_003f-1" href="#How-can-I-sort-the-rows-of-a-data-frame_003f">7.23 How can I sort the rows of a data frame?</a></li>
<li><a name="toc-Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f-1" href="#Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f">7.24 Why does the help.start() search engine not work?</a></li>
<li><a name="toc-Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f-1" href="#Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f">7.25 Why did my .Rprofile stop working when I updated R?</a></li>
<li><a name="toc-Where-have-all-the-methods-gone_003f-1" href="#Where-have-all-the-methods-gone_003f">7.26 Where have all the methods gone?</a></li>
<li><a name="toc-How-can-I-create-rotated-axis-labels_003f-1" href="#How-can-I-create-rotated-axis-labels_003f">7.27 How can I create rotated axis labels?</a></li>
<li><a name="toc-Why-is-read_002etable_0028_0029-so-inefficient_003f-1" href="#Why-is-read_002etable_0028_0029-so-inefficient_003f">7.28 Why is read.table() so inefficient?</a></li>
<li><a name="toc-What-is-the-difference-between-package-and-library_003f-1" href="#What-is-the-difference-between-package-and-library_003f">7.29 What is the difference between package and library?</a></li>
<li><a name="toc-I-installed-a-package-but-the-functions-are-not-there-1" href="#I-installed-a-package-but-the-functions-are-not-there">7.30 I installed a package but the functions are not there</a></li>
<li><a name="toc-Why-doesn_0027t-R-think-these-numbers-are-equal_003f-1" href="#Why-doesn_0027t-R-think-these-numbers-are-equal_003f">7.31 Why doesn’t R think these numbers are equal?</a></li>
<li><a name="toc-How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f-1" href="#How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f">7.32 How can I capture or ignore errors in a long simulation?</a></li>
<li><a name="toc-Why-are-powers-of-negative-numbers-wrong_003f-1" href="#Why-are-powers-of-negative-numbers-wrong_003f">7.33 Why are powers of negative numbers wrong?</a></li>
<li><a name="toc-How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f-1" href="#How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f">7.34 How can I save the result of each iteration in a loop into a separate file?</a></li>
<li><a name="toc-Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f-1" href="#Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f">7.35 Why are <em>p</em>-values not displayed when using lmer()?</a></li>
<li><a name="toc-Why-are-there-unwanted-borders_002c-lines-or-grid_002dlike-artifacts-when-viewing-a-plot-saved-to-a-PS-or-PDF-file_003f" href="#Why-are-there-unwanted-borders">7.36 Why are there unwanted borders, lines or grid-like artifacts when viewing a plot saved to a PS or PDF file?</a></li>
<li><a name="toc-Why-does-backslash-behave-strangely-inside-strings_003f-1" href="#Why-does-backslash-behave-strangely-inside-strings_003f">7.37 Why does backslash behave strangely inside strings?</a></li>
<li><a name="toc-How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f-1" href="#How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f">7.38 How can I put error bars or confidence bands on my plot?</a></li>
<li><a name="toc-How-do-I-create-a-plot-with-two-y_002daxes_003f-1" href="#How-do-I-create-a-plot-with-two-y_002daxes_003f">7.39 How do I create a plot with two y-axes?</a></li>
<li><a name="toc-How-do-I-access-the-source-code-for-a-function_003f-1" href="#How-do-I-access-the-source-code-for-a-function_003f">7.40 How do I access the source code for a function?</a></li>
<li><a name="toc-Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f-1" href="#Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f">7.41 Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?</a></li>
<li><a name="toc-Why-is-R-apparently-not-releasing-memory_003f-1" href="#Why-is-R-apparently-not-releasing-memory_003f">7.42 Why is R apparently not releasing memory?</a></li>
<li><a name="toc-How-can-I-enable-secure-https-downloads-in-R_003f-1" href="#How-can-I-enable-secure-https-downloads-in-R_003f">7.43 How can I enable secure https downloads in R?</a></li>
<li><a name="toc-How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f-1" href="#How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f">7.44 How can I get CRAN package binaries for outdated versions of R?</a></li>
</ul></li>
<li><a name="toc-R-Programming-1" href="#R-Programming">8 R Programming</a>
<ul class="no-bullet">
<li><a name="toc-How-should-I-write-summary-methods_003f-1" href="#How-should-I-write-summary-methods_003f">8.1 How should I write summary methods?</a></li>
<li><a name="toc-How-can-I-debug-dynamically-loaded-code_003f-1" href="#How-can-I-debug-dynamically-loaded-code_003f">8.2 How can I debug dynamically loaded code?</a></li>
<li><a name="toc-How-can-I-inspect-R-objects-when-debugging_003f-1" href="#How-can-I-inspect-R-objects-when-debugging_003f">8.3 How can I inspect R objects when debugging?</a></li>
<li><a name="toc-How-can-I-change-compilation-flags_003f-1" href="#How-can-I-change-compilation-flags_003f">8.4 How can I change compilation flags?</a></li>
<li><a name="toc-How-can-I-debug-S4-methods_003f-1" href="#How-can-I-debug-S4-methods_003f">8.5 How can I debug S4 methods?</a></li>
</ul></li>
<li><a name="toc-R-Bugs-1" href="#R-Bugs">9 R Bugs</a>
<ul class="no-bullet">
<li><a name="toc-What-is-a-bug_003f-1" href="#What-is-a-bug_003f">9.1 What is a bug?</a></li>
<li><a name="toc-How-to-report-a-bug-1" href="#How-to-report-a-bug">9.2 How to report a bug</a></li>
</ul></li>
<li><a name="toc-Acknowledgments-1" href="#Acknowledgments">10 Acknowledgments</a></li>
</ul>
</div>
<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-FAQ"></a>
<h1 class="top">R FAQ</h1>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Introduction" accesskey="1">Introduction</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Basics" accesskey="2">R Basics</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-and-S" accesskey="3">R and S</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Web-Interfaces" accesskey="4">R Web Interfaces</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Add_002dOn-Packages" accesskey="5">R Add-On Packages</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-and-Emacs" accesskey="6">R and Emacs</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Miscellanea" accesskey="7">R Miscellanea</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Programming" accesskey="8">R Programming</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#R-Bugs" accesskey="9">R Bugs</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Acknowledgments">Acknowledgments</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Introduction"></a>
<div class="header">
<p>
Next: <a href="#R-Basics" accesskey="n" rel="next">R Basics</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Introduction-1"></a>
<h2 class="chapter">1 Introduction</h2>
<p>This document contains answers to some of the most frequently asked
questions about R.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Legalese" accesskey="1">Legalese</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Obtaining-this-document" accesskey="2">Obtaining this document</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Citing-this-document" accesskey="3">Citing this document</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Notation" accesskey="4">Notation</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Feedback" accesskey="5">Feedback</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Legalese"></a>
<div class="header">
<p>
Next: <a href="#Obtaining-this-document" accesskey="n" rel="next">Obtaining this document</a>, Previous: <a href="#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Legalese-1"></a>
<h3 class="section">1.1 Legalese</h3>
<p>This document is copyright © 1998–2016 by Kurt
Hornik.
</p>
<p>This document is free software; you can redistribute it and/or modify it
under the terms of the <acronym>GNU</acronym> General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
</p>
<p>This document is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<acronym>GNU</acronym> General Public License for more details.
</p>
<p>Copies of the <acronym>GNU</acronym> General Public License versions are
available at
</p>
<div class="display">
<pre class="display"><a href="https://www.R-project.org/Licenses/">https://www.R-project.org/Licenses/</a>
</pre></div>
<hr>
<a name="Obtaining-this-document"></a>
<div class="header">
<p>
Next: <a href="#Citing-this-document" accesskey="n" rel="next">Citing this document</a>, Previous: <a href="#Legalese" accesskey="p" rel="prev">Legalese</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Obtaining-this-document-1"></a>
<h3 class="section">1.2 Obtaining this document</h3>
<p>The latest version of this document is always available from
</p>
<div class="display">
<pre class="display"><a href="https://CRAN.R-project.org/doc/FAQ/">https://CRAN.R-project.org/doc/FAQ/</a>
</pre></div>
<p>From there, you can obtain versions converted to
<a href="https://CRAN.R-project.org/doc/FAQ/R-FAQ.txt">plain
<acronym>ASCII</acronym> text</a>,
<a href="https://CRAN.R-project.org/doc/FAQ/R-FAQ.info.gz"><acronym>GNU</acronym>
info</a>, <a href="https://CRAN.R-project.org/doc/FAQ/R-FAQ.html"><acronym>HTML</acronym></a>,
<a href="https://CRAN.R-project.org/doc/FAQ/R-FAQ.pdf">PDF</a>,
as well as the <a href="https://CRAN.R-project.org/doc/FAQ/R-FAQ.texi">Texinfo source</a> used for creating all these formats using the
<acronym>GNU</acronym> Texinfo system.
</p>
<p>You can also obtain the R <acronym>FAQ</acronym> from the <samp>doc/FAQ</samp>
subdirectory of a <acronym>CRAN</acronym> site (see <a href="#What-is-CRAN_003f">What is CRAN?</a>).
</p>
<hr>
<a name="Citing-this-document"></a>
<div class="header">
<p>
Next: <a href="#Notation" accesskey="n" rel="next">Notation</a>, Previous: <a href="#Obtaining-this-document" accesskey="p" rel="prev">Obtaining this document</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Citing-this-document-1"></a>
<h3 class="section">1.3 Citing this document</h3>
<p>In publications, please refer to this <acronym>FAQ</acronym> as Hornik
(2016), “The R <acronym>FAQ</acronym>”, and give the above,
<em>official</em> <acronym>URL</acronym>:
</p>
<div class="example">
<pre class="example">@Misc{,
author = {Kurt Hornik},
title = {{R} {FAQ}},
year = {2016},
url = {https://CRAN.R-project.org/doc/FAQ/R-FAQ.html}
}
</pre></div>
<hr>
<a name="Notation"></a>
<div class="header">
<p>
Next: <a href="#Feedback" accesskey="n" rel="next">Feedback</a>, Previous: <a href="#Citing-this-document" accesskey="p" rel="prev">Citing this document</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Notation-1"></a>
<h3 class="section">1.4 Notation</h3>
<p>Everything should be pretty standard. ‘<samp>R></samp>’ is used for the R
prompt, and a ‘<samp>$</samp>’ for the shell prompt (where applicable).
</p>
<hr>
<a name="Feedback"></a>
<div class="header">
<p>
Previous: <a href="#Notation" accesskey="p" rel="prev">Notation</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Feedback-1"></a>
<h3 class="section">1.5 Feedback</h3>
<p>Feedback via email to <a href="mailto:Kurt.Hornik@R-project.org">Kurt.Hornik@R-project.org</a> is of course
most welcome.
</p>
<p>In particular, note that I do not have access to Windows or Mac
systems. Features specific to the Windows and macOS ports of R are
described in the
<a href="https://CRAN.R-project.org/bin/windows/base/rw-FAQ.html">“R for
Windows <acronym>FAQ</acronym>”</a> and the
<a href="https://CRAN.R-project.org/bin/macosx/RMacOSX-FAQ.html">“R for Mac
OS X <acronym>FAQ</acronym>”</a>. If you have information on Mac or Windows
systems that you think should be added to this document, please let me
know.
</p>
<hr>
<a name="R-Basics"></a>
<div class="header">
<p>
Next: <a href="#R-and-S" accesskey="n" rel="next">R and S</a>, Previous: <a href="#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Basics-1"></a>
<h2 class="chapter">2 R Basics</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#What-is-R_003f" accesskey="1">What is R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-machines-does-R-run-on_003f" accesskey="2">What machines does R run on?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-the-current-version-of-R_003f" accesskey="3">What is the current version of R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-R-be-obtained_003f" accesskey="4">How can R be obtained?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-R-be-installed_003f" accesskey="5">How can R be installed?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Are-there-Unix_002dlike-binaries-for-R_003f" accesskey="6">Are there Unix-like binaries for R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-documentation-exists-for-R_003f" accesskey="7">What documentation exists for R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Citing-R" accesskey="8">Citing R</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-mailing-lists-exist-for-R_003f" accesskey="9">What mailing lists exist for R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-CRAN_003f">What is CRAN?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Can-I-use-R-for-commercial-purposes_003f">Can I use R for commercial purposes?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-is-R-named-R_003f">Why is R named R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-the-R-Foundation_003f">What is the R Foundation?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-R_002dForge_003f">What is R-Forge?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="What-is-R_003f"></a>
<div class="header">
<p>
Next: <a href="#What-machines-does-R-run-on_003f" accesskey="n" rel="next">What machines does R run on?</a>, Previous: <a href="#R-Basics" accesskey="p" rel="prev">R Basics</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-R_003f-1"></a>
<h3 class="section">2.1 What is R?</h3>
<p>R is a system for statistical computation and graphics. It consists of
a language plus a run-time environment with graphics, a debugger, access
to certain system functions, and the ability to run programs stored in
script files.
</p>
<p>The design of R has been heavily influenced by two existing languages:
Becker, Chambers & Wilks’ S (see <a href="#What-is-S_003f">What is S?</a>) and Sussman’s
<a href="https://www.cs.indiana.edu/scheme-repository/home.html">Scheme</a>.
Whereas the resulting language is very similar in appearance to S, the
underlying implementation and semantics are derived from Scheme.
See <a href="#What-are-the-differences-between-R-and-S_003f">What are the differences between R and S?</a>, for further details.
</p>
<p>The core of R is an interpreted computer language which allows branching
and looping as well as modular programming using functions. Most of the
user-visible functions in R are written in R. It is possible for the
user to interface to procedures written in the C, C++, or FORTRAN
languages for efficiency. The R distribution contains functionality for
a large number of statistical procedures. Among these are: linear and
generalized linear models, nonlinear regression models, time series
analysis, classical parametric and nonparametric tests, clustering and
smoothing. There is also a large set of functions which provide a
flexible graphical environment for creating various kinds of data
presentations. Additional modules (“add-on packages”) are available
for a variety of specific purposes (see <a href="#R-Add_002dOn-Packages">R Add-On Packages</a>).
</p>
<p>R was initially written by <a href="mailto:Ross.Ihaka@R-project.org">Ross Ihaka</a>
and <a href="mailto:Robert.Gentleman@R-project.org">Robert Gentleman</a> at the
Department of Statistics of the University of Auckland in Auckland, New
Zealand. In addition, a large group of individuals has contributed to R
by sending code and bug reports.
</p>
<p>Since mid-1997 there has been a core group (the “R Core Team”) who can
modify the R source code archive. The group currently consists of Doug
Bates, John Chambers, Peter Dalgaard, Robert Gentleman,
Kurt Hornik, Ross Ihaka, Tomas Kalibera, Michael Lawrence, Friedrich Leisch, Uwe Ligges,
Thomas Lumley, Martin Maechler, Martin Morgan, Paul Murrell, Martyn
Plummer, Brian Ripley, Deepayan Sarkar, Duncan Temple Lang, Luke
Tierney, and Simon Urbanek.
</p>
<p>R has a home page at <a href="https://www.R-project.org/">https://www.R-project.org/</a>. It is
<a href="https://www.gnu.org/philosophy/free-sw.html">free software</a>
distributed under a <acronym>GNU</acronym>-style
<a href="https://www.gnu.org/copyleft/copyleft.html">copyleft</a>, and an
official part of the <a href="https://www.gnu.org/"><acronym>GNU</acronym></a> project
(“<acronym>GNU</acronym> S”).
</p>
<hr>
<a name="What-machines-does-R-run-on_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-the-current-version-of-R_003f" accesskey="n" rel="next">What is the current version of R?</a>, Previous: <a href="#What-is-R_003f" accesskey="p" rel="prev">What is R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-machines-does-R-run-on_003f-1"></a>
<h3 class="section">2.2 What machines does R run on?</h3>
<p>R is being developed for the Unix-like, Windows and Mac families of
operating systems. Support for Mac OS Classic ended with R 1.7.1.
</p>
<p>The current version of R will configure and build under a number of
common Unix-like (e.g., <a href="https://en.wikipedia.org/wiki/Unix-like">https://en.wikipedia.org/wiki/Unix-like</a>)
platforms including <var>cpu</var>-linux-gnu for the i386, amd64/x86_64,
alpha, arm, arm64, hppa, mips/mipsel, powerpc, s390x and sparc
<acronym>CPU</acronym>s (e.g.,
<a href="https://buildd.debian.org/build.php?&pkg=r-base">https://buildd.debian.org/build.php?&pkg=r-base</a>), i386-hurd-gnu,
<var>cpu</var>-kfreebsd-gnu for i386 and amd64,
i386-pc-solaris, rs6000-ibm-aix, sparc-sun-solaris, x86_64-apple-darwin,
x86_64-unknown-freebsd and x86_64-unknown-openbsd.
</p>
<p>If you know about other platforms, please drop us a note.
</p>
<hr>
<a name="What-is-the-current-version-of-R_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-R-be-obtained_003f" accesskey="n" rel="next">How can R be obtained?</a>, Previous: <a href="#What-machines-does-R-run-on_003f" accesskey="p" rel="prev">What machines does R run on?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-the-current-version-of-R_003f-1"></a>
<h3 class="section">2.3 What is the current version of R?</h3>
<p>R uses a ‘major.minor.patchlevel’ numbering scheme. Based on this,
there are the current release version of R (‘r-release’) as well as two
development versions of R, a patched version of the current release
(‘r-patched’) and one working towards the next minor or eventually major
(‘r-devel’) releases of R, respectively. New features are typically
introduced in r-devel, while r-patched is for bug fixes mostly.
</p>
<p>See <a href="https://CRAN.R-project.org/sources.html">https://CRAN.R-project.org/sources.html</a> for the current
versions of r-release, r-patched and r-devel.
</p>
<hr>
<a name="How-can-R-be-obtained_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-R-be-installed_003f" accesskey="n" rel="next">How can R be installed?</a>, Previous: <a href="#What-is-the-current-version-of-R_003f" accesskey="p" rel="prev">What is the current version of R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-R-be-obtained_003f-1"></a>
<h3 class="section">2.4 How can R be obtained?</h3>
<p>Sources, binaries and documentation for R can be obtained via <acronym>CRAN</acronym>,
the “Comprehensive R Archive Network” (see <a href="#What-is-CRAN_003f">What is CRAN?</a>).
</p>
<p>Sources are also available via <a href="https://svn.R-project.org/R/">https://svn.R-project.org/R/</a>, the
R Subversion repository, but currently not via anonymous rsync (nor
CVS).
</p>
<p>Tarballs with daily snapshots of the r-devel and r-patched development
versions of R can be found at
<a href="https://stat.ethz.ch/R/daily">https://stat.ethz.ch/R/daily</a>.
</p>
<hr>
<a name="How-can-R-be-installed_003f"></a>
<div class="header">
<p>
Next: <a href="#Are-there-Unix_002dlike-binaries-for-R_003f" accesskey="n" rel="next">Are there Unix-like binaries for R?</a>, Previous: <a href="#How-can-R-be-obtained_003f" accesskey="p" rel="prev">How can R be obtained?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-R-be-installed_003f-1"></a>
<h3 class="section">2.5 How can R be installed?</h3>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#How-can-R-be-installed-_0028Unix_002dlike_0029" accesskey="1">How can R be installed (Unix-like)</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-R-be-installed-_0028Windows_0029" accesskey="2">How can R be installed (Windows)</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-R-be-installed-_0028Mac_0029" accesskey="3">How can R be installed (Mac)</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="How-can-R-be-installed-_0028Unix_002dlike_0029"></a>
<div class="header">
<p>
Next: <a href="#How-can-R-be-installed-_0028Windows_0029" accesskey="n" rel="next">How can R be installed (Windows)</a>, Previous: <a href="#How-can-R-be-installed_003f" accesskey="p" rel="prev">How can R be installed?</a>, Up: <a href="#How-can-R-be-installed_003f" accesskey="u" rel="up">How can R be installed?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-R-be-installed-_0028Unix_002dlike_0029-1"></a>
<h4 class="subsection">2.5.1 How can R be installed (Unix-like)</h4>
<p>If R is already installed, it can be started by typing <kbd>R</kbd> at the
shell prompt (of course, provided that the executable is in your path).
</p>
<p>If binaries are available for your platform (see <a href="#Are-there-Unix_002dlike-binaries-for-R_003f">Are there Unix-like binaries for R?</a>), you can use these, following the
instructions that come with them.
</p>
<p>Otherwise, you can compile and install R yourself, which can be done
very easily under a number of common Unix-like platforms (see <a href="#What-machines-does-R-run-on_003f">What machines does R run on?</a>). The file <samp>INSTALL</samp> that comes with the
R distribution contains a brief introduction, and the “R Installation
and Administration” guide (see <a href="#What-documentation-exists-for-R_003f">What documentation exists for R?</a>)
has full details.
</p>
<p>Note that you need a FORTRAN compiler or perhaps <code>f2c</code> in
addition to a C compiler to build R.
</p>
<p>In the simplest case, untar the R source code, change to the directory
thus created, and issue the following commands (at the shell prompt):
</p>
<div class="example">
<pre class="example">$ ./configure
$ make
</pre></div>
<p>If these commands execute successfully, the R binary and a shell script
front-end called <samp>R</samp> are created and copied to the <samp>bin</samp>
directory. You can copy the script to a place where users can invoke
it, for example to <samp>/usr/local/bin</samp>. In addition, plain text help
pages as well as <acronym>HTML</acronym> and LaTeX versions of the documentation are
built.
</p>
<p>Use <kbd>make dvi</kbd> to create DVI versions of the R manuals, such as
<samp>refman.dvi</samp> (an R object reference index) and <samp>R-exts.dvi</samp>,
the “R Extension Writers Guide”, in the <samp>doc/manual</samp>
subdirectory. These files can be previewed and printed using standard
programs such as <code>xdvi</code> and <code>dvips</code>. You can also use
<kbd>make pdf</kbd> to build PDF (Portable Document Format) version of the
manuals, and view these using e.g. Acrobat. Manuals written in the
<acronym>GNU</acronym> Texinfo system can also be converted to info files
suitable for reading online with Emacs or stand-alone <acronym>GNU</acronym>
Info; use <kbd>make info</kbd> to create these versions (note that this
requires Makeinfo version 4.5).
</p>
<p>Finally, use <kbd>make check</kbd> to find out whether your R system works
correctly.
</p>
<p>You can also perform a “system-wide” installation using <kbd>make
install</kbd>. By default, this will install to the following directories:
</p>
<dl compact="compact">
<dt><samp>${prefix}/bin</samp></dt>
<dd><p>the front-end shell script
</p></dd>
<dt><samp>${prefix}/man/man1</samp></dt>
<dd><p>the man page
</p></dd>
<dt><samp>${prefix}/lib/R</samp></dt>
<dd><p>all the rest (libraries, on-line help system, …). This is the “R
Home Directory” (<code>R_HOME</code>) of the installed system.
</p></dd>
</dl>
<p>In the above, <code>prefix</code> is determined during configuration
(typically <samp>/usr/local</samp>) and can be set by running
<code>configure</code> with the option
</p>
<div class="example">
<pre class="example">$ ./configure --prefix=/where/you/want/R/to/go
</pre></div>
<p>(E.g., the R executable will then be installed into
<samp>/where/you/want/R/to/go/bin</samp>.)
</p>
<p>To install DVI, info and PDF versions of the manuals, use <kbd>make
install-dvi</kbd>, <kbd>make install-info</kbd> and <kbd>make install-pdf</kbd>,
respectively.
</p>
<hr>
<a name="How-can-R-be-installed-_0028Windows_0029"></a>
<div class="header">
<p>
Next: <a href="#How-can-R-be-installed-_0028Mac_0029" accesskey="n" rel="next">How can R be installed (Mac)</a>, Previous: <a href="#How-can-R-be-installed-_0028Unix_002dlike_0029" accesskey="p" rel="prev">How can R be installed (Unix-like)</a>, Up: <a href="#How-can-R-be-installed_003f" accesskey="u" rel="up">How can R be installed?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-R-be-installed-_0028Windows_0029-1"></a>
<h4 class="subsection">2.5.2 How can R be installed (Windows)</h4>
<p>The <samp>bin/windows</samp> directory of a <acronym>CRAN</acronym> site contains binaries for
a base distribution and add-on packages from <acronym>CRAN</acronym> to run on Windows
7 and later (including 64-bit versions of Windows) on ix86 and x86_64
chips. The Windows version of R was created by Robert Gentleman and
Guido Masarotto, Brian D. Ripley and Duncan Murdoch made substantial
contributions and it is now being maintained by
other members of the R Core team.
</p>
<p>The same directory has links to snapshots of the r-patched and r-devel
versions of R.
</p>
<p>See the <a href="https://CRAN.R-project.org/bin/windows/base/rw-FAQ.html">“R for Windows <acronym>FAQ</acronym>”</a> for more details.
</p>
<hr>
<a name="How-can-R-be-installed-_0028Mac_0029"></a>
<div class="header">
<p>
Previous: <a href="#How-can-R-be-installed-_0028Windows_0029" accesskey="p" rel="prev">How can R be installed (Windows)</a>, Up: <a href="#How-can-R-be-installed_003f" accesskey="u" rel="up">How can R be installed?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-R-be-installed-_0028Mac_0029-1"></a>
<h4 class="subsection">2.5.3 How can R be installed (Mac)</h4>
<p>The <samp>bin/macosx</samp> directory of a <acronym>CRAN</acronym> site contains a standard
Apple installer package to run on macOS 10.9 (‘Mavericks’) and later.
Once downloaded and executed, the installer will install the current
release of R and R.app, the macOS <acronym>GUI</acronym>. This port of R for macOS
is maintained by <a href="mailto:Simon.Urbanek@R-project.org">Simon Urbanek</a>
(and previously by Stefano Iacus). The
<a href="https://CRAN.R-project.org/bin/macosx/RMacOSX-FAQ.html">“R for Mac
macOS <acronym>FAQ</acronym></a> has more details.
</p>
<p>Snapshots of the r-patched and r-devel versions of R are available as
Apple installer packages at <a href="https://r.research.att.com">https://r.research.att.com</a>.
</p>
<hr>
<a name="Are-there-Unix_002dlike-binaries-for-R_003f"></a>
<div class="header">
<p>
Next: <a href="#What-documentation-exists-for-R_003f" accesskey="n" rel="next">What documentation exists for R?</a>, Previous: <a href="#How-can-R-be-installed_003f" accesskey="p" rel="prev">How can R be installed?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Are-there-Unix_002dlike-binaries-for-R_003f-1"></a>
<h3 class="section">2.6 Are there Unix-like binaries for R?</h3>
<p>The <samp>bin/linux</samp> directory of a <acronym>CRAN</acronym> site contains the following
packages.
</p>
<blockquote>
<table summary="">
<thead><tr><th></th><th>CPU</th><th>Versions</th><th>Provider</th></tr></thead>
<tr><td>Debian</td><td>i386/amd64</td><td>squeeze/wheezy</td><td>Johannes Ranke</td></tr>
<tr><td></td><td>armel</td><td>wheezy</td><td>Johannes Ranke</td></tr>
<tr><td>Ubuntu</td><td>i386/amd64</td><td>lucid/precise/trusty</td><td>Michael Rutter</td></tr>
</table>
</blockquote>
<p>Debian packages, maintained by Dirk Eddelbuettel, have long been part of
the Debian distribution, and can be accessed through APT, the Debian
package maintenance tool. Use e.g. <code>apt-get install r-base
r-recommended</code> to install the R environment and recommended packages.
If you also want to build R packages from source, also run <code>apt-get
install r-base-dev</code> to obtain the additional tools required for this.
So-called “backports” of the current R packages for at least the
<em>stable</em> distribution of Debian are provided by Johannes Ranke, and
available from <acronym>CRAN</acronym>. See
<a href="https://CRAN.R-project.org/bin/linux/debian/index.html">https://CRAN.R-project.org/bin/linux/debian/index.html</a> for details on R
Debian packages and installing the backports, which should also be
suitable for other Debian derivatives. Native backports for Ubuntu are
provided by Michael Rutter.
</p>
<p>R binaries for Fedora, maintained by Tom “Spot” Callaway, are provided
as part of the Fedora distribution and can be accessed through
<code>yum</code>, the RPM installer/updater. Note that the “Software”
application (gnome-software), which is the default <acronym>GUI</acronym> for
software installation in Fedora 20, cannot be used to install R. It is
therefore recommended to use the yum command line tool.
The Fedora R RPM is a “meta-package” which installs all the user and
developer components of R (available separately as <code>R-core</code> and
<code>R-devel</code>), as well as <code>R-java</code>, which ensures that R is
configured for use with Java. The R RPM also installs the standalone R
math library (<code>libRmath</code> and <code>libRmath-devel</code>), although this
is not necessary to use R. When a new version of R is released, there
may be a delay of up to 2 weeks until the Fedora RPM becomes publicly
available, as it must pass through the statutory Fedora review process.
RPMs for a selection of R packages are also provided by Fedora. The
Extra Packages for Enterprise Linux (EPEL) project
(<a href="https://fedoraproject.org/wiki/EPEL">https://fedoraproject.org/wiki/EPEL</a>) provides ports of the Fedora
RPMs for RedHat Enterprise Linux and compatible distributions (e.g.,
Centos, Scientific Linux, Oracle Linux).
</p>
<p>See <a href="https://CRAN.R-project.org/bin/linux/suse/README.html">https://CRAN.R-project.org/bin/linux/suse/README.html</a> for
information about RPMs for openSUSE.
</p>
<p>No other binary distributions are currently publically available via
<acronym>CRAN</acronym>.
</p>
<hr>
<a name="What-documentation-exists-for-R_003f"></a>
<div class="header">
<p>
Next: <a href="#Citing-R" accesskey="n" rel="next">Citing R</a>, Previous: <a href="#Are-there-Unix_002dlike-binaries-for-R_003f" accesskey="p" rel="prev">Are there Unix-like binaries for R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-documentation-exists-for-R_003f-1"></a>
<h3 class="section">2.7 What documentation exists for R?</h3>
<p>Online documentation for most of the functions and variables in R
exists, and can be printed on-screen by typing <kbd>help(<var>name</var>)</kbd>
(or <kbd>?<var>name</var></kbd>) at the R prompt, where <var>name</var> is the name of
the topic help is sought for. (In the case of unary and binary
operators and control-flow special forms, the name may need to be be
quoted.)
</p>
<p>This documentation can also be made available as one reference manual
for on-line reading in <acronym>HTML</acronym> and PDF formats, and as hardcopy via
LaTeX, see <a href="#How-can-R-be-installed_003f">How can R be installed?</a>. An up-to-date <acronym>HTML</acronym>
version is always available for web browsing at
<a href="https://stat.ethz.ch/R-manual/">https://stat.ethz.ch/R-manual/</a>.
</p>
<p>Printed copies of the R reference manual for some version(s) are
available from Network Theory Ltd, at
<a href="http://www.network-theory.co.uk/R/base/">http://www.network-theory.co.uk/R/base/</a>. For each set of manuals
sold, the publisher donates USD 10 to the R Foundation (see <a href="#What-is-the-R-Foundation_003f">What is the R Foundation?</a>).
</p>
<p>The R distribution also comes with the following manuals.
</p>
<ul>
<li> “An Introduction to R” (<samp>R-intro</samp>)
includes information on data types, programming elements, statistical
modeling and graphics. This document is based on the “Notes on
<small>S-PLUS</small>” by Bill Venables and David Smith.
</li><li> “Writing R Extensions” (<samp>R-exts</samp>)
currently describes the process of creating R add-on packages, writing R
documentation, R’s system and foreign language interfaces, and the R
<acronym>API</acronym>.
</li><li> “R Data Import/Export” (<samp>R-data</samp>)
is a guide to importing and exporting data to and from R.
</li><li> “The R Language Definition” (<samp>R-lang</samp>),
a first version of the “Kernighan & Ritchie of R”, explains
evaluation, parsing, object oriented programming, computing on the
language, and so forth.
</li><li> “R Installation and Administration” (<samp>R-admin</samp>).
</li><li> “R Internals” (<samp>R-ints</samp>)
is a guide to R’s internal structures.
(Added in R 2.4.0.)
</li></ul>
<p>An annotated bibliography (BibTeX format) of R-related publications
can be found at
</p>
<div class="display">
<pre class="display"><a href="https://www.R-project.org/doc/bib/R.bib">https://www.R-project.org/doc/bib/R.bib</a>
</pre></div>
<p>Books on R by R Core Team members include
</p>
<blockquote>
<p>John M. Chambers (2008), “Software for Data Analysis: Programming with
R”. Springer, New York, ISBN 978-0-387-75935-7,
<a href="http://statweb.stanford.edu/~jmc4/Rbook/">http://statweb.stanford.edu/~jmc4/Rbook/</a>.
</p>
<p>Peter Dalgaard (2008), “Introductory Statistics with R”, 2nd edition.
Springer, ISBN 978-0-387-79053-4,
<a href="http://publicifsv.sund.ku.dk/~pd/ISwR.html">http://publicifsv.sund.ku.dk/~pd/ISwR.html</a>.
</p>
<p>Robert Gentleman (2008), “R Programming for Bioinformatics”. Chapman
& Hall/CRC, Boca Raton, FL, ISBN 978-1-420-06367-7,
<a href="https://www.bioconductor.org/pub/RBioinf/">https://www.bioconductor.org/pub/RBioinf/</a>.
</p>
<p>Stefano M. Iacus (2008), “Simulation and Inference for Stochastic
Differential Equations: With R Examples”. Springer, New York, ISBN
978-0-387-75838-1.
</p>
<p>Deepayan Sarkar (2007), “Lattice: Multivariate Data Visualization with
R”. Springer, New York, ISBN 978-0-387-75968-5.
</p>
<p>W. John Braun and Duncan J. Murdoch (2007), “A First Course in
Statistical Programming with R”. Cambridge University Press,
Cambridge, ISBN 978-0521872652.
</p>
<p>P. Murrell (2005), “R Graphics”, Chapman & Hall/CRC, ISBN:
1-584-88486-X,
<a href="https://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html">https://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html</a>.
</p>
<p>William N. Venables and Brian D. Ripley (2002), “Modern Applied
Statistics with S” (4th edition). Springer, ISBN 0-387-95457-0,
<a href="https://www.stats.ox.ac.uk/pub/MASS4/">https://www.stats.ox.ac.uk/pub/MASS4/</a>.
</p>
<p>Jose C. Pinheiro and Douglas M. Bates (2000), “Mixed-Effects Models in
S and S-Plus”. Springer, ISBN 0-387-98957-0.
</p></blockquote>
<p>Last, but not least, Ross’ and Robert’s experience in designing and
implementing R is described in Ihaka & Gentleman (1996), “R: A Language
for Data Analysis and Graphics”,
<a href="http://www.amstat.org/publications/jcgs/"><em>Journal of
Computational and Graphical Statistics</em></a>, <strong>5</strong>, 299–314.
</p>
<hr>
<a name="Citing-R"></a>
<div class="header">
<p>
Next: <a href="#What-mailing-lists-exist-for-R_003f" accesskey="n" rel="next">What mailing lists exist for R?</a>, Previous: <a href="#What-documentation-exists-for-R_003f" accesskey="p" rel="prev">What documentation exists for R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Citing-R-1"></a>
<h3 class="section">2.8 Citing R</h3>
<p>To cite R in publications, use
</p>
<div class="example">
<pre class="example">@Manual{,
title = {R: A Language and Environment for Statistical
Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = <var>YEAR</var>,
url = {https://www.R-project.org}
}
</pre></div>
<p>where <var>YEAR</var> is the release year of the version of R used and can
determined as <code>R.version$year</code>.
</p>
<p>Citation strings (or BibTeX entries) for R and R packages can also be
obtained by <code>citation()</code>.
</p>
<hr>
<a name="What-mailing-lists-exist-for-R_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-CRAN_003f" accesskey="n" rel="next">What is CRAN?</a>, Previous: <a href="#Citing-R" accesskey="p" rel="prev">Citing R</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-mailing-lists-exist-for-R_003f-1"></a>
<h3 class="section">2.9 What mailing lists exist for R?</h3>
<p>Thanks to <a href="mailto:Martin.Maechler@R-project.org">Martin Maechler</a>, there
are several mailing lists devoted to R, including the following:
</p>
<dl compact="compact">
<dt><code>R-announce</code></dt>
<dd><p>A moderated list for major announcements about the development of R and
the availability of new code.
</p></dd>
<dt><code>R-packages</code></dt>
<dd><p>A moderated list for announcements on the availability of new or
enhanced contributed packages.
</p></dd>
<dt><code>R-help</code></dt>
<dd><p>The ‘main’ R mailing list, for discussion about problems and solutions
using R, announcements (not covered by ‘R-announce’ and ‘R-packages’)
about the development of R and the availability of new code.
</p></dd>
<dt><code>R-devel</code></dt>
<dd><p>This list is for questions and discussion about code development in R.
</p></dd>
<dt><code>R-package-devel</code></dt>
<dd><p>A list which which provides a forum for learning about the R package
development process.
</p></dd>
</dl>
<p>Please read the <a href="https://www.R-project.org/posting-guide.html">posting guide</a> <em>before</em> sending anything to any mailing list.
</p>
<p>Note in particular that R-help is intended to be comprehensible to
people who want to use R to solve problems but who are not necessarily
interested in or knowledgeable about programming. Questions likely to
prompt discussion unintelligible to non-programmers (e.g., questions
involving C or C++) should go to R-devel.
</p>
<p>Convenient access to information on these lists, subscription, and
archives is provided by the web interface at
<a href="https://stat.ethz.ch/mailman/listinfo/">https://stat.ethz.ch/mailman/listinfo/</a>. One can also subscribe
(or unsubscribe) via email, e.g. to R-help by sending ‘<samp>subscribe</samp>’
(or ‘<samp>unsubscribe</samp>’) in the <em>body</em> of the message (not in the
subject!) to <a href="mailto:R-help-request@lists.R-project.org">R-help-request@lists.R-project.org</a>.
</p>
<p>Send email to <a href="mailto:R-help@lists.R-project.org">R-help@lists.R-project.org</a> to send a message to
everyone on the R-help mailing list. Subscription and posting to the
other lists is done analogously, with ‘<samp>R-help</samp>’ replaced by
‘<samp>R-announce</samp>’, ‘<samp>R-packages</samp>’, and ‘<samp>R-devel</samp>’, respectively.
Note that the R-announce and R-packages lists are gatewayed into R-help.
Hence, you should subscribe to either of them only in case you are not
subscribed to R-help.
</p>
<p>It is recommended that you send mail to R-help rather than only to the R
Core developers (who are also subscribed to the list, of course). This
may save them precious time they can use for constantly improving R, and
will typically also result in much quicker feedback for yourself.
</p>
<p>Of course, in the case of bug reports it would be very helpful to have
code which reliably reproduces the problem. Also, make sure that you
include information on the system and version of R being used. See
<a href="#R-Bugs">R Bugs</a> for more details.
</p>
<p>See <a href="https://www.R-project.org/mail.html">https://www.R-project.org/mail.html</a> for more information on
the R mailing lists.
</p>
<p>The R Core Team can be reached at <a href="mailto:R-core@lists.R-project.org">R-core@lists.R-project.org</a>
for comments and reports.
</p>
<p>Many of the R project’s mailing lists are also available via
<a href="http://gmane.org">Gmane</a>, from which they can be read with a web
browser, using an NNTP news reader, or via RSS feeds. See
<a href="http://dir.gmane.org/index.php?prefix=gmane.comp.lang.r.">http://dir.gmane.org/index.php?prefix=gmane.comp.lang.r.</a> for
the available mailing lists, and <a href="http://www.gmane.org/rss.php">http://www.gmane.org/rss.php</a> for
details on RSS feeds.
</p>
<hr>
<a name="What-is-CRAN_003f"></a>
<div class="header">
<p>
Next: <a href="#Can-I-use-R-for-commercial-purposes_003f" accesskey="n" rel="next">Can I use R for commercial purposes?</a>, Previous: <a href="#What-mailing-lists-exist-for-R_003f" accesskey="p" rel="prev">What mailing lists exist for R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-CRAN_003f-1"></a>
<h3 class="section">2.10 What is <acronym>CRAN</acronym>?</h3>
<p>The “Comprehensive R Archive Network” (<acronym>CRAN</acronym>) is a collection of
sites which carry identical material, consisting of the R
distribution(s), the contributed extensions, documentation for R, and
binaries.
</p>
<p>The <acronym>CRAN</acronym> master site at WU (Wirtschaftsuniversität Wien) in Austria
can be found at the <acronym>URL</acronym>
</p>
<blockquote>
<p><a href="https://CRAN.R-project.org/">https://CRAN.R-project.org/</a>
</p></blockquote>
<p>and is mirrored daily to many sites around the world.
See <a href="https://CRAN.R-project.org/mirrors.html">https://CRAN.R-project.org/mirrors.html</a> for a complete list of
mirrors. Please use the <acronym>CRAN</acronym> site closest to you to reduce network
load.
</p>
<p>From <acronym>CRAN</acronym>, you can obtain the latest official release of R, daily
snapshots of R (copies of the current source trees), as gzipped and
bzipped tar files, a wealth of additional contributed code, as well as
prebuilt binaries for various operating systems (Linux, Mac OS Classic,
macOS, and MS Windows). <acronym>CRAN</acronym> also provides access to
documentation on R, existing mailing lists and the R Bug Tracking
system.
</p>
<p>Since March 2016, “old” material is made available from a central
<acronym>CRAN</acronym> archive server (<a href="https://CRAN-archive.R-project.org/">https://CRAN-archive.R-project.org/</a>).
</p>
<p>Please always use the <acronym>URL</acronym> of the master site when referring to
<acronym>CRAN</acronym>.
</p>
<hr>
<a name="Can-I-use-R-for-commercial-purposes_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-is-R-named-R_003f" accesskey="n" rel="next">Why is R named R?</a>, Previous: <a href="#What-is-CRAN_003f" accesskey="p" rel="prev">What is CRAN?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Can-I-use-R-for-commercial-purposes_003f-1"></a>
<h3 class="section">2.11 Can I use R for commercial purposes?</h3>
<p>R is released under the
<a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"><acronym>GNU</acronym> General Public License (<acronym>GPL</acronym>), version 2</a>. If
you have any questions regarding the legality of using R in any
particular situation you should bring it up with your legal counsel. We
are in no position to offer legal advice.
</p>
<p>It is the opinion of the R Core Team that one can use R for commercial
purposes (e.g., in business or in consulting). The <acronym>GPL</acronym>, like
all Open Source licenses, permits all and any use of the package. It
only restricts distribution of R or of other programs containing code
from R. This is made clear in clause 6 (“No Discrimination Against
Fields of Endeavor”) of the
<a href="https://opensource.org/docs/definition.html">Open Source
Definition</a>:
</p>
<blockquote>
<p>The license must not restrict anyone from making use of the program in a
specific field of endeavor. For example, it may not restrict the
program from being used in a business, or from being used for genetic
research.
</p></blockquote>
<p>It is also explicitly stated in clause 0 of the GPL, which says in part
</p>
<blockquote>
<p>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of running
the Program is not restricted, and the output from the Program is
covered only if its contents constitute a work based on the Program.
</p></blockquote>
<p>Most add-on packages, including all recommended ones, also explicitly
allow commercial use in this way. A few packages are restricted to
“non-commercial use”; you should contact the author to clarify whether
these may be used or seek the advice of your legal counsel.
</p>
<p>None of the discussion in this section constitutes legal advice. The R
Core Team does not provide legal advice under any circumstances.
</p>
<hr>
<a name="Why-is-R-named-R_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-the-R-Foundation_003f" accesskey="n" rel="next">What is the R Foundation?</a>, Previous: <a href="#Can-I-use-R-for-commercial-purposes_003f" accesskey="p" rel="prev">Can I use R for commercial purposes?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-is-R-named-R_003f-1"></a>
<h3 class="section">2.12 Why is R named R?</h3>
<p>The name is partly based on the (first) names of the first two R authors
(Robert Gentleman and Ross Ihaka), and partly a play on the name of the
Bell Labs language ‘S’ (see <a href="#What-is-S_003f">What is S?</a>).
</p>
<hr>
<a name="What-is-the-R-Foundation_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-R_002dForge_003f" accesskey="n" rel="next">What is R-Forge?</a>, Previous: <a href="#Why-is-R-named-R_003f" accesskey="p" rel="prev">Why is R named R?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-the-R-Foundation_003f-1"></a>
<h3 class="section">2.13 What is the R Foundation?</h3>
<p>The R Foundation is a not for profit organization working in the public
interest. It was founded by the members of the R Core Team in order to
provide support for the R project and other innovations in statistical
computing, provide a reference point for individuals, institutions or
commercial enterprises that want to support or interact with the R
development community, and to hold and administer the copyright of R
software and documentation. See
<a href="https://www.R-project.org/foundation/">https://www.R-project.org/foundation/</a> for more information.
</p>
<hr>
<a name="What-is-R_002dForge_003f"></a>
<div class="header">
<p>
Previous: <a href="#What-is-the-R-Foundation_003f" accesskey="p" rel="prev">What is the R Foundation?</a>, Up: <a href="#R-Basics" accesskey="u" rel="up">R Basics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-R_002dForge_003f-1"></a>
<h3 class="section">2.14 What is R-Forge?</h3>
<p>R-Forge (<a href="https://R-Forge.R-project.org/">https://R-Forge.R-project.org/</a>) offers a central platform
for the development of R packages, R-related software and further
projects. It is based on <a href="https://en.wikipedia.org/wiki/GForge">GForge</a> offering
easy access to the best in SVN, daily built and checked packages,
mailing lists, bug tracking, message boards/forums, site hosting,
permanent file archival, full backups, and total web-based
administration. For more information, see the R-Forge web page and
Stefan Theußl and Achim Zeileis (2009), “Collaborative software
development using R-Forge”, <a href="https://journal.R-project.org/"><em>The R Journal</em></a>, <strong>1</strong>(1):9–14.
</p>
<hr>
<a name="R-and-S"></a>
<div class="header">
<p>
Next: <a href="#R-Web-Interfaces" accesskey="n" rel="next">R Web Interfaces</a>, Previous: <a href="#R-Basics" accesskey="p" rel="prev">R Basics</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-and-S-1"></a>
<h2 class="chapter">3 R and S</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#What-is-S_003f" accesskey="1">What is S?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-S_002dPLUS_003f" accesskey="2">What is S-PLUS?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="3">What are the differences between R and S?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f" accesskey="4">Is there anything R can do that S-PLUS cannot?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-R_002dplus_003f" accesskey="5">What is R-plus?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="What-is-S_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-S_002dPLUS_003f" accesskey="n" rel="next">What is S-PLUS?</a>, Previous: <a href="#R-and-S" accesskey="p" rel="prev">R and S</a>, Up: <a href="#R-and-S" accesskey="u" rel="up">R and S</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-S_003f-1"></a>
<h3 class="section">3.1 What is S?</h3>
<p>S is a very high level language and an environment for data analysis and
graphics. In 1998, the Association for Computing Machinery
(<acronym>ACM</acronym>) presented its Software System Award to John M. Chambers,
the principal designer of S, for
</p>
<blockquote>
<p>the S system, which has forever altered the way people analyze,
visualize, and manipulate data …
</p>
<p>S is an elegant, widely accepted, and enduring software system, with
conceptual integrity, thanks to the insight, taste, and effort of John
Chambers.
</p></blockquote>
<p>The evolution of the S language is characterized by four books by John
Chambers and coauthors, which are also the primary references for S.
</p>
<ul>
<li> Richard A. Becker and John M. Chambers (1984), “S. An Interactive
Environment for Data Analysis and Graphics,” Monterey: Wadsworth and
Brooks/Cole.
<p>This is also referred to as the “<em>Brown Book</em>”, and of historical
interest only.
</p>
</li><li> Richard A. Becker, John M. Chambers and Allan R. Wilks (1988), “The New
S Language,” London: Chapman & Hall.
<p>This book is often called the “<em>Blue Book</em>”, and introduced what
is now known as S version 2.
</p>
</li><li> John M. Chambers and Trevor J. Hastie (1992), “Statistical Models in
S,” London: Chapman & Hall.
<p>This is also called the “<em>White Book</em>”, and introduced S version
3, which added structures to facilitate statistical modeling in S.
</p>
</li><li> John M. Chambers (1998), “Programming with Data,” New York: Springer,
ISBN 0-387-98503-4
(<a href="http://statweb.stanford.edu/~jmc4/Sbook/">http://statweb.stanford.edu/~jmc4/Sbook/</a>).
<p>This “<em>Green Book</em>” describes version 4 of S, a major revision of
S designed by John Chambers to improve its usefulness at every stage of
the programming process.
</p></li></ul>
<p>See <a href="http://statweb.stanford.edu/~jmc4/papers/96.7.ps">http://statweb.stanford.edu/~jmc4/papers/96.7.ps</a>
for further information on the “Evolution of the S Language”.
</p>
<hr>
<a name="What-is-S_002dPLUS_003f"></a>
<div class="header">
<p>
Next: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="n" rel="next">What are the differences between R and S?</a>, Previous: <a href="#What-is-S_003f" accesskey="p" rel="prev">What is S?</a>, Up: <a href="#R-and-S" accesskey="u" rel="up">R and S</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-S_002dPLUS_003f-1"></a>
<h3 class="section">3.2 What is <small>S-PLUS</small>?</h3>
<p><small>S-PLUS</small> is a value-added version of S currently sold by
<a href="http://www.tibco.com/">TIBCO Software Inc</a> as ‘TIBCO Spotfire S+’.
See <a href="https://en.wikipedia.org/wiki/S-PLUS">https://en.wikipedia.org/wiki/S-PLUS</a> for more information.
</p>
<hr>
<a name="What-are-the-differences-between-R-and-S_003f"></a>
<div class="header">
<p>
Next: <a href="#Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f" accesskey="n" rel="next">Is there anything R can do that S-PLUS cannot?</a>, Previous: <a href="#What-is-S_002dPLUS_003f" accesskey="p" rel="prev">What is S-PLUS?</a>, Up: <a href="#R-and-S" accesskey="u" rel="up">R and S</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-are-the-differences-between-R-and-S_003f-1"></a>
<h3 class="section">3.3 What are the differences between R and S?</h3>
<p>We can regard S as a language with three current implementations or
“engines”, the “old S engine” (S version 3; <small>S-PLUS</small> 3.x and 4.x),
the “new S engine” (S version 4; <small>S-PLUS</small> 5.x and above), and R.
Given this understanding, asking for “the differences between R and S”
really amounts to asking for the specifics of the R implementation of
the S language, i.e., the difference between the R and S <em>engines</em>.
</p>
<p>For the remainder of this section, “S” refers to the S engines and not
the S language.
</p>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Lexical-scoping" accesskey="1">Lexical scoping</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Models" accesskey="2">Models</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Others" accesskey="3">Others</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Lexical-scoping"></a>
<div class="header">
<p>
Next: <a href="#Models" accesskey="n" rel="next">Models</a>, Previous: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="p" rel="prev">What are the differences between R and S?</a>, Up: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="u" rel="up">What are the differences between R and S?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Lexical-scoping-1"></a>
<h4 class="subsection">3.3.1 Lexical scoping</h4>
<p>Contrary to other implementations of the S language, R has adopted an
evaluation model in which nested function definitions are lexically
scoped. This is analogous to the evaluation model in Scheme.
</p>
<p>This difference becomes manifest when <em>free</em> variables occur in a
function. Free variables are those which are neither formal parameters
(occurring in the argument list of the function) nor local variables
(created by assigning to them in the body of the function). In S, the
values of free variables are determined by a set of global variables
(similar to C, there is only local and global scope). In R, they are
determined by the environment in which the function was created.
</p>
<p>Consider the following function:
</p>
<div class="example">
<pre class="example">cube <- function(n) {
sq <- function() n * n
n * sq()
}
</pre></div>
<p>Under S, <code>sq()</code> does not “know” about the variable <code>n</code>
unless it is defined globally:
</p>
<div class="example">
<pre class="example">S> cube(2)
Error in sq(): Object "n" not found
Dumped
S> n <- 3
S> cube(2)
[1] 18
</pre></div>
<p>In R, the “environment” created when <code>cube()</code> was invoked is
also looked in:
</p>
<div class="example">
<pre class="example">R> cube(2)
[1] 8
</pre></div>
<p>As a more “interesting” real-world problem, suppose you want to write
a function which returns the density function of the <em>r</em>-th order
statistic from a sample of size <em>n</em> from a (continuous)
distribution. For simplicity, we shall use both the cdf and pdf of the
distribution as explicit arguments. (Example compiled from various
postings by Luke Tierney.)
</p>
<p>The <small>S-PLUS</small> documentation for <code>call()</code> basically suggests the
following:
</p>
<div class="example">
<pre class="example">dorder <- function(n, r, pfun, dfun) {
f <- function(x) NULL
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
PF <- call(substitute(pfun), as.name("x"))
DF <- call(substitute(dfun), as.name("x"))
f[[length(f)]] <-
call("*", con,
call("*", call("^", PF, r - 1),
call("*", call("^", call("-", 1, PF), n - r),
DF)))
f
}
</pre></div>
<p>Rather tricky, isn’t it? The code uses the fact that in S,
functions are just lists of special mode with the function body as the
last argument, and hence does not work in R (one could make the idea
work, though).
</p>
<p>A version which makes heavy use of <code>substitute()</code> and seems to work
under both S and R is
</p>
<div class="example">
<pre class="example">dorder <- function(n, r, pfun, dfun) {
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
eval(substitute(function(x) K * PF(x)^a * (1 - PF(x))^b * DF(x),
list(PF = substitute(pfun), DF = substitute(dfun),
a = r - 1, b = n - r, K = con)))
}
</pre></div>
<p>(the <code>eval()</code> is not needed in S).
</p>
<p>However, in R there is a much easier solution:
</p>
<div class="example">
<pre class="example">dorder <- function(n, r, pfun, dfun) {
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
function(x) {
con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
}
}
</pre></div>
<p>This seems to be the “natural” implementation, and it works because
the free variables in the returned function can be looked up in the
defining environment (this is lexical scope).
</p>
<p>Note that what you really need is the function <em>closure</em>, i.e., the
body along with all variable bindings needed for evaluating it. Since
in the above version, the free variables in the value function are not
modified, you can actually use it in S as well if you abstract out the
closure operation into a function <code>MC()</code> (for “make closure”):
</p>
<div class="example">
<pre class="example">dorder <- function(n, r, pfun, dfun) {
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
MC(function(x) {
con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
},
list(con = con, pfun = pfun, dfun = dfun, r = r, n = n))
}
</pre></div>
<p>Given the appropriate definitions of the closure operator, this works in
both R and S, and is much “cleaner” than a substitute/eval solution
(or one which overrules the default scoping rules by using explicit
access to evaluation frames, as is of course possible in both R and S).
</p>
<p>For R, <code>MC()</code> simply is
</p>
<div class="example">
<pre class="example">MC <- function(f, env) f
</pre></div>
<p>(lexical scope!), a version for S is
</p>
<div class="example">
<pre class="example">MC <- function(f, env = NULL) {
env <- as.list(env)
if (mode(f) != "function")
stop(paste("not a function:", f))
if (length(env) > 0 && any(names(env) == ""))
stop(paste("not all arguments are named:", env))
fargs <- if(length(f) > 1) f[1:(length(f) - 1)] else NULL
fargs <- c(fargs, env)
if (any(duplicated(names(fargs))))
stop(paste("duplicated arguments:", paste(names(fargs)),
collapse = ", "))
fbody <- f[length(f)]
cf <- c(fargs, fbody)
mode(cf) <- "function"
return(cf)
}
</pre></div>
<p>Similarly, most optimization (or zero-finding) routines need some
arguments to be optimized over and have other parameters that depend on
the data but are fixed with respect to optimization. With R scoping
rules, this is a trivial problem; simply make up the function with the
required definitions in the same environment and scoping takes care of
it. With S, one solution is to add an extra parameter to the function
and to the optimizer to pass in these extras, which however can only
work if the optimizer supports this.
</p>
<p>Nested lexically scoped functions allow using function closures and
maintaining local state. A simple example (taken from Abelson and
Sussman) is obtained by typing <kbd>demo("scoping")</kbd> at the R prompt.
Further information is provided in the standard R reference “R: A
Language for Data Analysis and Graphics” (see <a href="#What-documentation-exists-for-R_003f">What documentation exists for R?</a>) and in Robert Gentleman and Ross Ihaka (2000), “Lexical
Scope and Statistical Computing”,
<a href="http://www.amstat.org/publications/jcgs/"><em>Journal of
Computational and Graphical Statistics</em></a>, <strong>9</strong>, 491–508.
</p>
<p>Nested lexically scoped functions also imply a further major difference.
Whereas S stores all objects as separate files in a directory somewhere
(usually <samp>.Data</samp> under the current directory), R does not. All
objects in R are stored internally. When R is started up it grabs a
piece of memory and uses it to store the objects. R performs its own
memory management of this piece of memory, growing and shrinking its
size as needed. Having everything in memory is necessary because it is
not really possible to externally maintain all relevant “environments”
of symbol/value pairs. This difference also seems to make R
<em>faster</em> than S.
</p>
<p>The down side is that if R crashes you will lose all the work for the
current session. Saving and restoring the memory “images” (the
functions and data stored in R’s internal memory at any time) can be a
bit slow, especially if they are big. In S this does not happen,
because everything is saved in disk files and if you crash nothing is
likely to happen to them. (In fact, one might conjecture that the S
developers felt that the price of changing their approach to persistent
storage just to accommodate lexical scope was far too expensive.)
Hence, when doing important work, you might consider saving often (see
<a href="#How-can-I-save-my-workspace_003f">How can I save my workspace?</a>) to safeguard against possible
crashes. Other possibilities are logging your sessions, or have your R
commands stored in text files which can be read in using
<code>source()</code>.
</p>
<blockquote>
<p><b>Note:</b> If you run R from within Emacs (see <a href="#R-and-Emacs">R and Emacs</a>), you can save the
contents of the interaction buffer to a file and conveniently manipulate
it using <code>ess-transcript-mode</code>, as well as save source copies of
all functions and data used.
</p></blockquote>
<hr>
<a name="Models"></a>
<div class="header">
<p>
Next: <a href="#Others" accesskey="n" rel="next">Others</a>, Previous: <a href="#Lexical-scoping" accesskey="p" rel="prev">Lexical scoping</a>, Up: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="u" rel="up">What are the differences between R and S?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Models-1"></a>
<h4 class="subsection">3.3.2 Models</h4>
<p>There are some differences in the modeling code, such as
</p>
<ul>
<li> Whereas in S, you would use <code>lm(y ~ x^3)</code> to regress <code>y</code> on
<code>x^3</code>, in R, you have to insulate powers of numeric vectors (using
<code>I()</code>), i.e., you have to use <code>lm(y ~ I(x^3))</code>.
</li><li> The glm family objects are implemented differently in R and S. The same
functionality is available but the components have different names.
</li><li> Option <code>na.action</code> is set to <code>"na.omit"</code> by default in R,
but not set in S.
</li><li> Terms objects are stored differently. In S a terms object is an
expression with attributes, in R it is a formula with attributes. The
attributes have the same names but are mostly stored differently.
</li><li> Finally, in R <code>y ~ x + 0</code> is an alternative to <code>y ~ x - 1</code> for
specifying a model with no intercept. Models with no parameters at all
can be specified by <code>y ~ 0</code>.
</li></ul>
<hr>
<a name="Others"></a>
<div class="header">
<p>
Previous: <a href="#Models" accesskey="p" rel="prev">Models</a>, Up: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="u" rel="up">What are the differences between R and S?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Others-1"></a>
<h4 class="subsection">3.3.3 Others</h4>
<p>Apart from lexical scoping and its implications, R follows the S
language definition in the Blue and White Books as much as possible, and
hence really is an “implementation” of S. There are some intentional
differences where the behavior of S is considered “not clean”. In
general, the rationale is that R should help you detect programming
errors, while at the same time being as compatible as possible with S.
</p>
<p>Some known differences are the following.
</p>
<ul>
<li> In R, if <code>x</code> is a list, then <code>x[i] <- NULL</code> and <code>x[[i]]
<- NULL</code> remove the specified elements from <code>x</code>. The first of
these is incompatible with S, where it is a no-op. (Note that you can
set elements to <code>NULL</code> using <code>x[i] <- list(NULL)</code>.)
</li><li> In S, the functions named <code>.First</code> and <code>.Last</code> in the
<samp>.Data</samp> directory can be used for customizing, as they are executed
at the very beginning and end of a session, respectively.
<p>In R, the startup mechanism is as follows. Unless <samp>--no-environ</samp>
was given on the command line, R searches for site and user files to
process for setting environment variables. Then, R searches for a
site-wide startup profile unless the command line option
<samp>--no-site-file</samp> was given. This code is loaded in package
<strong>base</strong>. Then, unless <samp>--no-init-file</samp> was given, R
searches for a user profile file, and sources it into the user
workspace. It then loads a saved image of the user workspace from
<samp>.RData</samp> in case there is one (unless <samp>--no-restore-data</samp> or
<samp>--no-restore</samp> were specified). Next, a function <code>.First()</code>
is run if found on the search path. Finally, function <code>.First.sys</code>
in the <strong>base</strong> package is run. When terminating an R session, by
default a function <code>.Last</code> is run if found on the search path,
followed by <code>.Last.sys</code>. If needed, the functions <code>.First()</code>
and <code>.Last()</code> should be defined in the appropriate startup
profiles. See the help pages for <code>.First</code> and <code>.Last</code> for
more details.
</p>
</li><li> In R, <code>T</code> and <code>F</code> are just variables being set to <code>TRUE</code>
and <code>FALSE</code>, respectively, but are not reserved words as in S and
hence can be overwritten by the user. (This helps e.g. when you have
factors with levels <code>"T"</code> or <code>"F"</code>.) Hence, when writing code
you should always use <code>TRUE</code> and <code>FALSE</code>.
</li><li> In R, <code>dyn.load()</code> can only load <em>shared objects</em>, as created
for example by <kbd>R CMD SHLIB</kbd>.
</li><li> In R, <code>attach()</code> currently only works for lists and data frames,
but not for directories. (In fact, <code>attach()</code> also works for R
data files created with <code>save()</code>, which is analogous to attaching
directories in S.) Also, you cannot attach at position 1.
</li><li> Categories do not exist in R, and never will as they are deprecated now
in S. Use factors instead.
</li><li> In R, <code>For()</code> loops are not necessary and hence not supported.
</li><li> In R, <code>assign()</code> uses the argument <samp>envir=</samp> rather than
<samp>where=</samp> as in S.
</li><li> The random number generators are different, and the seeds have different
length.
</li><li> R passes integer objects to C as <code>int *</code> rather than <code>long *</code>
as in S.
</li><li> R has no single precision storage mode. However, as of version 0.65.1,
there is a single precision interface to C/FORTRAN subroutines.
</li><li> By default, <code>ls()</code> returns the names of the objects in the current
(under R) and global (under S) environment, respectively. For example,
given
<div class="example">
<pre class="example">x <- 1; fun <- function() {y <- 1; ls()}
</pre></div>
<p>then <code>fun()</code> returns <code>"y"</code> in R and <code>"x"</code> (together with
the rest of the global environment) in S.
</p>
</li><li> R allows for zero-extent matrices (and arrays, i.e., some elements of
the <code>dim</code> attribute vector can be 0). This has been determined a
useful feature as it helps reducing the need for special-case tests for
empty subsets. For example, if <code>x</code> is a matrix, <code>x[, FALSE]</code>
is not <code>NULL</code> but a “matrix” with 0 columns. Hence, such objects
need to be tested for by checking whether their <code>length()</code> is zero
(which works in both R and S), and not using <code>is.null()</code>.
</li><li> Named vectors are considered vectors in R but not in S (e.g.,
<code>is.vector(c(a = 1:3))</code> returns <code>FALSE</code> in S and <code>TRUE</code>
in R).
</li><li> Data frames are not considered as matrices in R (i.e., if <code>DF</code> is a
data frame, then <code>is.matrix(DF)</code> returns <code>FALSE</code> in R and
<code>TRUE</code> in S).
</li><li> R by default uses treatment contrasts in the unordered case, whereas S
uses the Helmert ones. This is a deliberate difference reflecting the
opinion that treatment contrasts are more natural.
</li><li> In R, the argument of a replacement function which corresponds to the
right hand side must be named ‘<samp>value</samp>’. E.g., <code>f(a) <- b</code> is
evaluated as <code>a <- "f<-"(a, value = b)</code>. S always takes the last
argument, irrespective of its name.
</li><li> In S, <code>substitute()</code> searches for names for substitution in the
given expression in three places: the actual and the default arguments
of the matching call, and the local frame (in that order). R looks in
the local frame only, with the special rule to use a “promise” if a
variable is not evaluated. Since the local frame is initialized with
the actual arguments or the default expressions, this is usually
equivalent to S, until assignment takes place.
</li><li> In S, the index variable in a <code>for()</code> loop is local to the inside
of the loop. In R it is local to the environment where the <code>for()</code>
statement is executed.
</li><li> In S, <code>tapply(simplify=TRUE)</code> returns a vector where R returns a
one-dimensional array (which can have named dimnames).
</li><li> In S(-<small>PLUS</small>) the C locale is used, whereas in R the current
operating system locale is used for determining which characters are
alphanumeric and how they are sorted. This affects the set of valid
names for R objects (for example accented chars may be allowed in R) and
ordering in sorts and comparisons (such as whether <code>"aA" < "Bb"</code> is
true or false). From version 1.2.0 the locale can be (re-)set in R by
the <code>Sys.setlocale()</code> function.
</li><li> In S, <code>missing(<var>arg</var>)</code> remains <code>TRUE</code> if <var>arg</var> is
subsequently modified; in R it doesn’t.
</li><li> From R version 1.3.0, <code>data.frame</code> strips <code>I()</code> when creating
(column) names.
</li><li> In R, the string <code>"NA"</code> is not treated as a missing value in a
character variable. Use <code>as.character(NA)</code> to create a missing
character value.
</li><li> R disallows repeated formal arguments in function calls.
</li><li> In S, <code>dump()</code>, <code>dput()</code> and <code>deparse()</code> are essentially
different interfaces to the same code. In R from version 2.0.0, this is
only true if the same <code>control</code> argument is used, but by default it
is not. By default <code>dump()</code> tries to write code that will evaluate
to reproduce the object, whereas <code>dput()</code> and <code>deparse()</code>
default to options for producing deparsed code that is readable.
</li><li> In R, indexing a vector, matrix, array or data frame with <code>[</code> using
a character vector index looks only for exact matches (whereas <code>[[</code>
and <code>$</code> allow partial matches). In S, <code>[</code> allows partial
matches.
</li><li> S has a two-argument version of <code>atan</code> and no <code>atan2</code>. A call
in S such as <code>atan(x1, x2)</code> is equivalent to R’s <code>atan2(x1,
x2)</code>. However, beware of named arguments since S’s <code>atan(x = a, y
= b)</code> is equivalent to R’s <code>atan2(y = a, x = b)</code> with the meanings
of <code>x</code> and <code>y</code> interchanged. (R used to have undocumented
support for a two-argument <code>atan</code> with positional arguments, but
this has been withdrawn to avoid further confusion.)
</li><li> Numeric constants with no fractional and exponent (i.e., only integer)
part are taken as integer in <small>S-PLUS</small> 6.x or later, but as double in R.
</li></ul>
<p>There are also differences which are not intentional, and result from
missing or incorrect code in R. The developers would appreciate hearing
about any deficiencies you may find (in a written report fully
documenting the difference as you see it). Of course, it would be
useful if you were to implement the change yourself and make sure it
works.
</p>
<hr>
<a name="Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-R_002dplus_003f" accesskey="n" rel="next">What is R-plus?</a>, Previous: <a href="#What-are-the-differences-between-R-and-S_003f" accesskey="p" rel="prev">What are the differences between R and S?</a>, Up: <a href="#R-and-S" accesskey="u" rel="up">R and S</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f-1"></a>
<h3 class="section">3.4 Is there anything R can do that <small>S-PLUS</small> cannot?</h3>
<p>Since almost anything you can do in R has source code that you could
port to <small>S-PLUS</small> with little effort there will never be much you can do
in R that you couldn’t do in <small>S-PLUS</small> if you wanted to. (Note that
using lexical scoping may simplify matters considerably, though.)
</p>
<p>R offers several graphics features that <small>S-PLUS</small> does not, such as finer
handling of line types, more convenient color handling (via palettes),
gamma correction for color, and, most importantly, mathematical
annotation in plot texts, via input expressions reminiscent of TeX
constructs. See the help page for <code>plotmath</code>, which features an
impressive on-line example. More details can be found in Paul Murrell
and Ross Ihaka (2000), “An Approach to Providing Mathematical
Annotation in Plots”, <a href="http://www.amstat.org/publications/jcgs/"><em>Journal of Computational and Graphical Statistics</em></a>, <strong>9</strong>,
582–599.
</p>
<hr>
<a name="What-is-R_002dplus_003f"></a>
<div class="header">
<p>
Previous: <a href="#Is-there-anything-R-can-do-that-S_002dPLUS-cannot_003f" accesskey="p" rel="prev">Is there anything R can do that S-PLUS cannot?</a>, Up: <a href="#R-and-S" accesskey="u" rel="up">R and S</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-R_002dplus_003f-1"></a>
<h3 class="section">3.5 What is R-plus?</h3>
<p>For a very long time, there was no such thing.
</p>
<p><a href="http://www.xlsolutions-corp.com/">XLSolutions Corporation</a> is
currently beta testing a commercially supported version of R named R+
(read R plus).
</p>
<p><a href="http://www.revolution-computing.com/">Revolution Analytics</a> has
released
<a href="http://www.revolution-computing.com/products/revolution-r.php">REvolution R</a>, an enterprise-class statistical analysis system based on
R, suitable for deployment in professional, commercial and regulated
environments.
</p>
<p>See also
<a href="https://en.wikipedia.org/wiki/R_programming_language#Commercialized_versions_of_R">https://en.wikipedia.org/wiki/R_programming_language#Commercialized_versions_of_R</a>
for pointers to commercialized versions of R.
</p>
<hr>
<a name="R-Web-Interfaces"></a>
<div class="header">
<p>
Next: <a href="#R-Add_002dOn-Packages" accesskey="n" rel="next">R Add-On Packages</a>, Previous: <a href="#R-and-S" accesskey="p" rel="prev">R and S</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Web-Interfaces-1"></a>
<h2 class="chapter">4 R Web Interfaces</h2>
<p><strong>Rweb</strong> is developed and maintained by
<a href="mailto:jeff@math.montana.edu">Jeff Banfield</a>. The
<a href="https://rweb.stat.umn.edu/Rweb/">Rweb Home Page</a> provides access
to all three versions of Rweb—a simple text entry form that returns
output and graphs, a more sophisticated JavaScript version that provides
a multiple window environment, and a set of point and click modules that
are useful for introductory statistics courses and require no knowledge
of the R language. All of the Rweb versions can analyze Web accessible
datasets if a <acronym>URL</acronym> is provided.
</p>
<p>The paper “Rweb: Web-based Statistical Analysis”, providing a detailed
explanation of the different versions of Rweb and an overview of how
Rweb works, was published in the Journal of Statistical Software
(<a href="http://www.jstatsoft.org/v04/i01/">http://www.jstatsoft.org/v04/i01/</a>).
</p>
<p><a href="mailto:ulfi@cs.tu-berlin.de">Ulf Bartel</a> has developed
<strong>R-Online</strong>, a simple on-line programming environment for R which
intends to make the first steps in statistical programming with R
(especially with time series) as easy as possible. There is no need for
a local installation since the only requirement for the user is a
JavaScript capable browser. See <a href="http://www.osvisions.com/r_online/">http://www.osvisions.com/r_online/</a>
for more information.
</p>
<p><strong>Rcgi</strong> is a CGI WWW interface to R by <a href="mailto:mjr@dsl.pipex.com">MJ Ray</a>. It had the ability to use “embedded code”: you could mix
user input and code, allowing the <acronym>HTML</acronym> author to do anything from
load in data sets to enter most of the commands for users without
writing CGI scripts. Graphical output was possible in PostScript or GIF
formats and the executed code was presented to the user for revision.
However, it is not clear if the project is still active.
</p>
<p>There are many additional examples of web interfaces to R which
basically allow to submit R code to a remote server, see for example the
collection of links available from
<a href="http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatCompCourse">http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatCompCourse</a>.
</p>
<p><a href="http://www.warwick.ac.uk/go/dfirth">David Firth</a> has written
<a href="https://CRAN.R-project.org/package=CGIwithR"><strong>CGIwithR</strong></a>, an R add-on package available from <acronym>CRAN</acronym>. It
provides some simple extensions to R to facilitate running R scripts
through the CGI interface to a web server, and allows submission of data
using both GET and POST methods. It is easily installed using Apache
under Linux and in principle should run on any platform that supports R
and a web server provided that the installer has the necessary security
permissions. David’s paper “CGIwithR: Facilities for Processing Web
Forms Using R” was published in the Journal of Statistical Software
(<a href="http://www.jstatsoft.org/v08/i10/">http://www.jstatsoft.org/v08/i10/</a>). The package is now
maintained by <a href="mailto:duncan@wald.ucdavis.edu">Duncan Temple Lang</a>.
and has a web page at <a href="http://www.omegahat.net/CGIwithR/">http://www.omegahat.net/CGIwithR/</a>.
</p>
<p>Jeff Horner is working on the R/Apache Integration Project which embeds
the R interpreter inside Apache 2 (and beyond). A tutorial and
presentation are available from the project web page at
<a href="http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/RApacheProject">http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/RApacheProject</a>.
</p>
<p><a href="https://www.rforge.net/Rserve/">Rserve</a> is a project
actively developed by Simon Urbanek. It implements a TCP/IP server which
allows other programs to use facilities of R. Clients are available from
the web site for Java and C++ (and could be written for other languages
that support TCP/IP sockets).
</p>
<p>Two projects use PHP to provide a web interface to R.
<a href="http://steve-chen.net/R_PHP/">R_PHP_Online</a> by Steve Chen (though
it is unclear if this project is still active) is somewhat similar to
the above Rcgi and Rweb. <a href="http://dssm.unipa.it/R-php/?cmd=home">R-php</a> is actively developed by Alfredo Pontillo and Angelo Mineo and
provides both a web interface to R and a set of pre-specified analyses
that need no R code input.
</p>
<p><a href="https://www.bioconductor.org/">webbioc</a> is “an integrated web
interface for doing microarray analysis using several of the
Bioconductor packages” and is designed to be installed at local sites
as a shared computing resource.
</p>
<p><a href="http://sysbio.mrc-bsu.cam.ac.uk/Rwui">Rwui</a> is a web application to
create user-friendly web interfaces for R scripts. All code for the web
interface is created automatically. There is no need for the user to do
any extra scripting or learn any new scripting techniques.
</p>
<p>The <a href="https://CRAN.R-project.org/package=R.rsp"><strong>R.rsp</strong></a> package by Henrik Bengtsson introduces “R Server
Pages”. Analogous to Java Server Pages, an R server page is typically
<acronym>HTML</acronym> with embedded R code that gets evaluated when the page is
requested. The package includes an internal cross-platform
<acronym>HTTP</acronym> server implemented in Tcl, so provides a good framework
for including web-based user interfaces in packages. The approach is
similar to the use of the <a href="https://CRAN.R-project.org/package=brew"><strong>brew</strong></a> package with
<a href="http://rapache.net/">Rapache</a> with the advantage of cross-platform
support and easy installation.
</p>
<p>The <a href="https://CRAN.R-project.org/package=Rook"><strong>Rook</strong></a> package by Jeffrey Horner provides a web server
interface borrowing heavily from Ruby’s Rack project.
</p>
<p>Finally, <a href="http://code.google.com/p/concerto-platform/">Concerto</a> is
a user friendly open-source Web Interface to R developed at the
Psychometrics Centre of Cambridge University. It was designed as an
online platform to design and run Computerized Adaptive Tests, but can
be also used as a general-purpose R Web Interface. It allows R users
with no programming or web designing background to quickly develop
flexible and powerful online applications, websites, and psychometrics
tests. To maximize its reliability, security, and performance, Concerto
relies on the popular and reliable open-source elements such as MySQL
server (exchange and storage of the data), <a href="https://rstudio.org/">Rstudio</a> (R code designing and testing, file management), CKEditor
(<acronym>HTML</acronym> Layer design), and PHP.
</p>
<hr>
<a name="R-Add_002dOn-Packages"></a>
<div class="header">
<p>
Next: <a href="#R-and-Emacs" accesskey="n" rel="next">R and Emacs</a>, Previous: <a href="#R-Web-Interfaces" accesskey="p" rel="prev">R Web Interfaces</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Add_002dOn-Packages-1"></a>
<h2 class="chapter">5 R Add-On Packages</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="1">Which add-on packages exist for R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-add_002don-packages-be-installed_003f" accesskey="2">How can add-on packages be installed?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-add_002don-packages-be-used_003f" accesskey="3">How can add-on packages be used?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-add_002don-packages-be-removed_003f" accesskey="4">How can add-on packages be removed?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-create-an-R-package_003f" accesskey="5">How can I create an R package?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-contribute-to-R_003f" accesskey="6">How can I contribute to R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Which-add_002don-packages-exist-for-R_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-add_002don-packages-be-installed_003f" accesskey="n" rel="next">How can add-on packages be installed?</a>, Previous: <a href="#R-Add_002dOn-Packages" accesskey="p" rel="prev">R Add-On Packages</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Which-add_002don-packages-exist-for-R_003f-1"></a>
<h3 class="section">5.1 Which add-on packages exist for R?</h3>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Add_002don-packages-in-R" accesskey="1">Add-on packages in R</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Add_002don-packages-from-CRAN" accesskey="2">Add-on packages from CRAN</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Add_002don-packages-from-Omegahat" accesskey="3">Add-on packages from Omegahat</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Add_002don-packages-from-Bioconductor" accesskey="4">Add-on packages from Bioconductor</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Other-add_002don-packages" accesskey="5">Other add-on packages</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Add_002don-packages-in-R"></a>
<div class="header">
<p>
Next: <a href="#Add_002don-packages-from-CRAN" accesskey="n" rel="next">Add-on packages from CRAN</a>, Previous: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="p" rel="prev">Which add-on packages exist for R?</a>, Up: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="u" rel="up">Which add-on packages exist for R?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Add_002don-packages-in-R-1"></a>
<h4 class="subsection">5.1.1 Add-on packages in R</h4>
<p>The R distribution comes with the following packages:
</p>
<dl compact="compact">
<dt><strong>base</strong></dt>
<dd><p>Base R functions (and datasets before R 2.0.0).
</p></dd>
<dt><strong>compiler</strong></dt>
<dd><p>R byte code compiler (added in R 2.13.0).
</p></dd>
<dt><strong>datasets</strong></dt>
<dd><p>Base R datasets (added in R 2.0.0).
</p></dd>
<dt><strong>grDevices</strong></dt>
<dd><p>Graphics devices for base and grid graphics (added in R 2.0.0).
</p></dd>
<dt><strong>graphics</strong></dt>
<dd><p>R functions for base graphics.
</p></dd>
<dt><strong>grid</strong></dt>
<dd><p>A rewrite of the graphics layout capabilities, plus some support for
interaction.
</p></dd>
<dt><strong>methods</strong></dt>
<dd><p>Formally defined methods and classes for R objects, plus other
programming tools, as described in the Green Book.
</p></dd>
<dt><strong>parallel</strong></dt>
<dd><p>Support for parallel computation, including by forking and by sockets,
and random-number generation (added in R 2.14.0).
</p></dd>
<dt><strong>splines</strong></dt>
<dd><p>Regression spline functions and classes.
</p></dd>
<dt><strong>stats</strong></dt>
<dd><p>R statistical functions.
</p></dd>
<dt><strong>stats4</strong></dt>
<dd><p>Statistical functions using S4 classes.
</p></dd>
<dt><strong>tcltk</strong></dt>
<dd><p>Interface and language bindings to Tcl/Tk <acronym>GUI</acronym> elements.
</p></dd>
<dt><strong>tools</strong></dt>
<dd><p>Tools for package development and administration.
</p></dd>
<dt><strong>utils</strong></dt>
<dd><p>R utility functions.
</p></dd>
</dl>
<p>These “base packages” were substantially reorganized in R 1.9.0. The
former <strong>base</strong> was split into the four packages <strong>base</strong>,
<strong>graphics</strong>, <strong>stats</strong>, and <strong>utils</strong>. Packages <strong>ctest</strong>,
<strong>eda</strong>, <strong>modreg</strong>, <strong>mva</strong>, <strong>nls</strong>, <strong>stepfun</strong> and
<strong>ts</strong> were merged into <strong>stats</strong>, package <strong>lqs</strong> returned to the
recommended package <a href="https://CRAN.R-project.org/package=MASS"><strong>MASS</strong></a>, and package <strong>mle</strong> moved to
<strong>stats4</strong>.
</p>
<hr>
<a name="Add_002don-packages-from-CRAN"></a>
<div class="header">
<p>
Next: <a href="#Add_002don-packages-from-Omegahat" accesskey="n" rel="next">Add-on packages from Omegahat</a>, Previous: <a href="#Add_002don-packages-in-R" accesskey="p" rel="prev">Add-on packages in R</a>, Up: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="u" rel="up">Which add-on packages exist for R?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Add_002don-packages-from-CRAN-1"></a>
<h4 class="subsection">5.1.2 Add-on packages from <acronym>CRAN</acronym></h4>
<p>The <acronym>CRAN</acronym> <samp>src/contrib</samp> area contains a wealth of add-on
packages, including the following <em>recommended</em> packages which are
to be included in all binary distributions of R.
</p>
<dl compact="compact">
<dt><strong>KernSmooth</strong></dt>
<dd><p>Functions for kernel smoothing (and density estimation) corresponding to
the book “Kernel Smoothing” by M. P. Wand and M. C. Jones, 1995.
</p></dd>
<dt><strong>MASS</strong></dt>
<dd><p>Functions and datasets from the main package of Venables and Ripley,
“Modern Applied Statistics with S”.
(Contained in the <samp>VR</samp> bundle for R versions prior to 2.10.0.)
</p></dd>
<dt><strong>Matrix</strong></dt>
<dd><p>A Matrix package.
(Recommended for R 2.9.0 or later.)
</p></dd>
<dt><strong>boot</strong></dt>
<dd><p>Functions and datasets for bootstrapping from the book “Bootstrap
Methods and Their Applications” by A. C. Davison and D. V. Hinkley,
1997, Cambridge University Press.
</p></dd>
<dt><strong>class</strong></dt>
<dd><p>Functions for classification (<em>k</em>-nearest neighbor and LVQ).
(Contained in the <samp>VR</samp> bundle for R versions prior to 2.10.0.)
</p></dd>
<dt><strong>cluster</strong></dt>
<dd><p>Functions for cluster analysis.
</p></dd>
<dt><strong>codetools</strong></dt>
<dd><p>Code analysis tools.
(Recommended for R 2.5.0 or later.)
</p></dd>
<dt><strong>foreign</strong></dt>
<dd><p>Functions for reading and writing data stored by statistical software
like Minitab, S, SAS, SPSS, Stata, Systat, etc.
</p></dd>
<dt><strong>lattice</strong></dt>
<dd><p>Lattice graphics, an implementation of Trellis Graphics functions.
</p></dd>
<dt><strong>mgcv</strong></dt>
<dd><p>Routines for GAMs and other generalized ridge regression problems with
multiple smoothing parameter selection by GCV or UBRE.
</p></dd>
<dt><strong>nlme</strong></dt>
<dd><p>Fit and compare Gaussian linear and nonlinear mixed-effects models.
</p></dd>
<dt><strong>nnet</strong></dt>
<dd><p>Software for single hidden layer perceptrons (“feed-forward neural
networks”), and for multinomial log-linear models.
(Contained in the <samp>VR</samp> bundle for R versions prior to 2.10.0.)
</p></dd>
<dt><strong>rpart</strong></dt>
<dd><p>Recursive PARTitioning and regression trees.
</p></dd>
<dt><strong>spatial</strong></dt>
<dd><p>Functions for kriging and point pattern analysis from “Modern Applied
Statistics with S” by W. Venables and B. Ripley.
(Contained in the <samp>VR</samp> bundle for R versions prior to 2.10.0.)
</p></dd>
<dt><strong>survival</strong></dt>
<dd><p>Functions for survival analysis, including penalized likelihood.
</p></dd>
</dl>
<p>See the <a href="https://CRAN.R-project.org/web/packages/"><acronym>CRAN</acronym>
contributed packages page</a> for more information.
</p>
<p>Many of these packages are categorized into
<a href="https://CRAN.R-project.org/web/views/"><acronym>CRAN</acronym> Task Views</a>, allowing
to browse packages by topic and providing tools to automatically install
all packages for special areas of interest.
</p>
<p>Some <acronym>CRAN</acronym> packages that do not build out of the box on Windows,
require additional software, or are shipping third party libraries for
Windows cannot be made available on <acronym>CRAN</acronym> in form of a Windows binary
packages. Nevertheless, some of these packages are available at the
“<acronym>CRAN</acronym> extras” repository at
<a href="https://www.stats.ox.ac.uk/pub/RWin/">https://www.stats.ox.ac.uk/pub/RWin/</a> kindly provided by Brian
D. Ripley. Note that this repository is a default repository for recent
versions of R for Windows.
</p>
<hr>
<a name="Add_002don-packages-from-Omegahat"></a>
<div class="header">
<p>
Next: <a href="#Add_002don-packages-from-Bioconductor" accesskey="n" rel="next">Add-on packages from Bioconductor</a>, Previous: <a href="#Add_002don-packages-from-CRAN" accesskey="p" rel="prev">Add-on packages from CRAN</a>, Up: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="u" rel="up">Which add-on packages exist for R?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Add_002don-packages-from-Omegahat-1"></a>
<h4 class="subsection">5.1.3 Add-on packages from Omegahat</h4>
<p>The <a href="http://www.omegahat.net/">Omega Project for Statistical
Computing</a> provides a variety of open-source software for statistical
applications, with special emphasis on web-based software, Java, the
Java virtual machine, and distributed computing. A <acronym>CRAN</acronym> style
R package repository is available via <a href="http://www.omegahat.net/R/">http://www.omegahat.net/R/</a>.
See <a href="http://www.omegahat.net/">http://www.omegahat.net/</a> for information on most R packages
available from the Omega project.
</p>
<hr>
<a name="Add_002don-packages-from-Bioconductor"></a>
<div class="header">
<p>
Next: <a href="#Other-add_002don-packages" accesskey="n" rel="next">Other add-on packages</a>, Previous: <a href="#Add_002don-packages-from-Omegahat" accesskey="p" rel="prev">Add-on packages from Omegahat</a>, Up: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="u" rel="up">Which add-on packages exist for R?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Add_002don-packages-from-Bioconductor-1"></a>
<h4 class="subsection">5.1.4 Add-on packages from Bioconductor</h4>
<p><a href="https://www.bioconductor.org/">Bioconductor</a> is an open source and
open development software project for the analysis and comprehension of
genomic data. Most Bioconductor components are distributed as R add-on
packages. Initially most of the
<a href="https://bioconductor.org/packages/release/BiocViews.html#___Software">Bioconductor software packages</a>
focused primarily on DNA microarray data analysis. As the
project has matured, the functional scope of the software packages
broadened to include the analysis of all types of genomic data, such as
SAGE, sequence, or SNP data. In addition, there are metadata
(annotation, CDF and probe) and experiment data packages. See
<a href="https://www.bioconductor.org/download/">https://www.bioconductor.org/download/</a> for available packages and a
complete taxonomy via BioC Views.
</p>
<hr>
<a name="Other-add_002don-packages"></a>
<div class="header">
<p>
Previous: <a href="#Add_002don-packages-from-Bioconductor" accesskey="p" rel="prev">Add-on packages from Bioconductor</a>, Up: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="u" rel="up">Which add-on packages exist for R?</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Other-add_002don-packages-1"></a>
<h4 class="subsection">5.1.5 Other add-on packages</h4>
<p>Many more packages are available from places other than the three
default repositories discussed above (<acronym>CRAN</acronym>, Bioconductor and
Omegahat). In particular, R-Forge provides a <acronym>CRAN</acronym> style repository
at <a href="https://R-Forge.R-project.org/">https://R-Forge.R-project.org/</a>.
</p>
<p>More code has been posted to the R-help mailing list, and can be
obtained from the mailing list archive.
</p>
<hr>
<a name="How-can-add_002don-packages-be-installed_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-add_002don-packages-be-used_003f" accesskey="n" rel="next">How can add-on packages be used?</a>, Previous: <a href="#Which-add_002don-packages-exist-for-R_003f" accesskey="p" rel="prev">Which add-on packages exist for R?</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-add_002don-packages-be-installed_003f-1"></a>
<h3 class="section">5.2 How can add-on packages be installed?</h3>
<p>(Unix-like only.) The add-on packages on <acronym>CRAN</acronym> come as gzipped tar
files named <code><var>pkg</var>_<var>version</var>.tar.gz</code>, which may in fact be
“bundles” containing more than one package. Let <var>path</var> be the
path to such a package file. Provided that <code>tar</code> and
<code>gzip</code> are available on your system, type
</p>
<div class="example">
<pre class="example">$ R CMD INSTALL <var>path</var>/<var>pkg</var>_<var>version</var>.tar.gz
</pre></div>
<p>at the shell prompt to install to the library tree rooted at the first
directory in your library search path (see the help page for
<code>.libPaths()</code> for details on how the search path is determined).
</p>
<p>To install to another tree (e.g., your private one), use
</p>
<div class="example">
<pre class="example">$ R CMD INSTALL -l <var>lib</var> <var>path</var>/<var>pkg</var>_<var>version</var>.tar.gz
</pre></div>
<p>where <var>lib</var> gives the path to the library tree to install to.
</p>
<p>Even more conveniently, you can install and automatically update
packages from within R if you have access to repositories such as
<acronym>CRAN</acronym>. See the help page for <code>available.packages()</code> for more
information.
</p>
<hr>
<a name="How-can-add_002don-packages-be-used_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-add_002don-packages-be-removed_003f" accesskey="n" rel="next">How can add-on packages be removed?</a>, Previous: <a href="#How-can-add_002don-packages-be-installed_003f" accesskey="p" rel="prev">How can add-on packages be installed?</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-add_002don-packages-be-used_003f-1"></a>
<h3 class="section">5.3 How can add-on packages be used?</h3>
<p>To find out which additional packages are available on your system, type
</p>
<div class="example">
<pre class="example">library()
</pre></div>
<p>at the R prompt.
</p>
<p>This produces something like
</p>
<blockquote>
<table summary="" class="cartouche" border="1"><tr><td>
<div class="smallexample">
<pre class="smallexample">Packages in ‘/home/me/lib/R’:
mystuff My own R functions, nicely packaged but not documented
Packages in ‘/usr/local/lib/R/library’:
KernSmooth Functions for kernel smoothing for Wand & Jones (1995)
MASS Main Package of Venables and Ripley's MASS
Matrix Sparse and Dense Matrix Classes and Methods
base The R Base package
boot Bootstrap R (S-Plus) Functions (Canty)
class Functions for Classification
cluster Functions for clustering (by Rousseeuw et al.)
codetools Code Analysis Tools for R
datasets The R Datasets Package
foreign Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat,
dBase, ...
grDevices The R Graphics Devices and Support for Colours and Fonts
graphics The R Graphics Package
grid The Grid Graphics Package
lattice Lattice Graphics
methods Formal Methods and Classes
mgcv GAMs with GCV/AIC/REML smoothness estimation and GAMMs
by PQL
nlme Linear and Nonlinear Mixed Effects Models
nnet Feed-forward Neural Networks and Multinomial Log-Linear
Models
rpart Recursive Partitioning
spatial Functions for Kriging and Point Pattern Analysis
splines Regression Spline Functions and Classes
stats The R Stats Package
stats4 Statistical functions using S4 Classes
survival Survival analysis, including penalised likelihood
tcltk Tcl/Tk Interface
tools Tools for Package Development
utils The R Utils Package
</pre></div>
</td></tr></table>
</blockquote>
<p>You can “load” the installed package <var>pkg</var> by
</p>
<div class="example">
<pre class="example">library(<var>pkg</var>)
</pre></div>
<p>You can then find out which functions it provides by typing one of
</p>
<div class="example">
<pre class="example">library(help = <var>pkg</var>)
help(package = <var>pkg</var>)
</pre></div>
<p>You can unload the loaded package <var>pkg</var> by
</p>
<div class="example">
<pre class="example">detach("package:<var>pkg</var>", unload = TRUE)
</pre></div>
<p>(where <code>unload = TRUE</code> is needed only for packages with a
namespace, see <code>?unload</code>).
</p>
<hr>
<a name="How-can-add_002don-packages-be-removed_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-create-an-R-package_003f" accesskey="n" rel="next">How can I create an R package?</a>, Previous: <a href="#How-can-add_002don-packages-be-used_003f" accesskey="p" rel="prev">How can add-on packages be used?</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-add_002don-packages-be-removed_003f-1"></a>
<h3 class="section">5.4 How can add-on packages be removed?</h3>
<p>Use
</p>
<div class="example">
<pre class="example">$ R CMD REMOVE <var>pkg_1</var> … <var>pkg_n</var>
</pre></div>
<p>to remove the packages <var>pkg_1</var>, …, <var>pkg_n</var> from the
library tree rooted at the first directory given in <code>R_LIBS</code> if this
is set and non-null, and from the default library otherwise. (Versions
of R prior to 1.3.0 removed from the default library by default.)
</p>
<p>To remove from library <var>lib</var>, do
</p>
<div class="example">
<pre class="example">$ R CMD REMOVE -l <var>lib</var> <var>pkg_1</var> … <var>pkg_n</var>
</pre></div>
<hr>
<a name="How-can-I-create-an-R-package_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-contribute-to-R_003f" accesskey="n" rel="next">How can I contribute to R?</a>, Previous: <a href="#How-can-add_002don-packages-be-removed_003f" accesskey="p" rel="prev">How can add-on packages be removed?</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-create-an-R-package_003f-1"></a>
<h3 class="section">5.5 How can I create an R package?</h3>
<p>A package consists of a subdirectory containing a file
<samp>DESCRIPTION</samp> and the subdirectories <samp>R</samp>, <samp>data</samp>,
<samp>demo</samp>, <samp>exec</samp>, <samp>inst</samp>, <samp>man</samp>, <samp>po</samp>,
<samp>src</samp>, and <samp>tests</samp> (some of which can be missing). The
package subdirectory may also contain files <samp>INDEX</samp>,
<samp>NAMESPACE</samp>, <samp>configure</samp>, <samp>cleanup</samp>, <samp>LICENSE</samp>,
<samp>LICENCE</samp>, <samp>COPYING</samp> and <samp>NEWS</samp>.
</p>
<p>See <a href="http://cran.r-project.org/doc/manuals/R-exts.html#Creating-R-packages">Creating R packages</a> in <cite>Writing R
Extensions</cite>, for details.
</p>
<p>R version 1.3.0 has added the function <code>package.skeleton()</code> which
will set up directories, save data and code, and create skeleton help
files for a set of R functions and datasets.
</p>
<p>See <a href="#What-is-CRAN_003f">What is CRAN?</a>, for information on uploading a package to <acronym>CRAN</acronym>.
</p>
<hr>
<a name="How-can-I-contribute-to-R_003f"></a>
<div class="header">
<p>
Previous: <a href="#How-can-I-create-an-R-package_003f" accesskey="p" rel="prev">How can I create an R package?</a>, Up: <a href="#R-Add_002dOn-Packages" accesskey="u" rel="up">R Add-On Packages</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-contribute-to-R_003f-1"></a>
<h3 class="section">5.6 How can I contribute to R?</h3>
<p>R is in active development and there is always a risk of bugs creeping
in. Also, the developers do not have access to all possible machines
capable of running R. So, simply using it and communicating problems is
certainly of great value.
</p>
<p>The <a href="https://developer.R-project.org/">R Developer Page</a> acts as an
intermediate repository for more or less finalized ideas and plans for
the R statistical system. It contains (pointers to) TODO lists, RFCs,
various other writeups, ideas lists, and SVN miscellanea.
</p>
<hr>
<a name="R-and-Emacs"></a>
<div class="header">
<p>
Next: <a href="#R-Miscellanea" accesskey="n" rel="next">R Miscellanea</a>, Previous: <a href="#R-Add_002dOn-Packages" accesskey="p" rel="prev">R Add-On Packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-and-Emacs-1"></a>
<h2 class="chapter">6 R and Emacs</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Is-there-Emacs-support-for-R_003f" accesskey="1">Is there Emacs support for R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Should-I-run-R-from-within-Emacs_003f" accesskey="2">Should I run R from within Emacs?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Debugging-R-from-within-Emacs" accesskey="3">Debugging R from within Emacs</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Is-there-Emacs-support-for-R_003f"></a>
<div class="header">
<p>
Next: <a href="#Should-I-run-R-from-within-Emacs_003f" accesskey="n" rel="next">Should I run R from within Emacs?</a>, Previous: <a href="#R-and-Emacs" accesskey="p" rel="prev">R and Emacs</a>, Up: <a href="#R-and-Emacs" accesskey="u" rel="up">R and Emacs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Is-there-Emacs-support-for-R_003f-1"></a>
<h3 class="section">6.1 Is there Emacs support for R?</h3>
<p>There is an Emacs package called <acronym>ESS</acronym> (“Emacs Speaks
Statistics”) which provides a standard interface between statistical
programs and statistical processes. It is intended to provide
assistance for interactive statistical programming and data analysis.
Languages supported include: S dialects (R, S 3/4, and <small>S-PLUS</small>
3.x/4.x/5.x/6.x/7.x), LispStat dialects (XLispStat, ViSta), SAS, Stata,
and BUGS.
</p>
<p><acronym>ESS</acronym> grew out of the need for bug fixes and extensions to
S-mode 4.8 (which was a <acronym>GNU</acronym> Emacs interface to S/<small>S-PLUS</small>
version 3 only). The current set of developers desired support for
XEmacs, R, S4, and MS Windows. In addition, with new modes being
developed for R, Stata, and SAS, it was felt that a unifying interface
and framework for the user interface would benefit both the user and the
developer, by helping both groups conform to standard Emacs usage. The
end result is an increase in efficiency for statistical programming and
data analysis, over the usual tools.
</p>
<p>R support contains code for editing R source code (syntactic indentation
and highlighting of source code, partial evaluations of code, loading
and error-checking of code, and source code revision maintenance) and
documentation (syntactic indentation and highlighting of source code,
sending examples to running <acronym>ESS</acronym> process, and previewing),
interacting with an inferior R process from within Emacs (command-line
editing, searchable command history, command-line completion of R object
and file names, quick access to object and search lists, transcript
recording, and an interface to the help system), and transcript
manipulation (recording and saving transcript files, manipulating and
editing saved transcripts, and re-evaluating commands from transcript
files).
</p>
<p>The latest stable version of <acronym>ESS</acronym> is available via <acronym>CRAN</acronym> or
the <a href="https://ESS.R-project.org/">ESS web page</a>.
</p>
<p><acronym>ESS</acronym> comes with detailed installation instructions.
</p>
<p>For help with <acronym>ESS</acronym>, send email to
<a href="mailto:ESS-help@r-project.org">ESS-help@r-project.org</a>.
</p>
<p>Please send bug reports and suggestions on <acronym>ESS</acronym> to
<a href="mailto:ESS-bugs@r-project.org">ESS-bugs@r-project.org</a>. The easiest way to do this from is
within Emacs by typing <kbd>M-x ess-submit-bug-report</kbd> or using the
[ESS] or [iESS] pulldown menus.
</p>
<hr>
<a name="Should-I-run-R-from-within-Emacs_003f"></a>
<div class="header">
<p>
Next: <a href="#Debugging-R-from-within-Emacs" accesskey="n" rel="next">Debugging R from within Emacs</a>, Previous: <a href="#Is-there-Emacs-support-for-R_003f" accesskey="p" rel="prev">Is there Emacs support for R?</a>, Up: <a href="#R-and-Emacs" accesskey="u" rel="up">R and Emacs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Should-I-run-R-from-within-Emacs_003f-1"></a>
<h3 class="section">6.2 Should I run R from within Emacs?</h3>
<p>Yes, <em>definitely</em>. Inferior R mode provides a readline/history
mechanism, object name completion, and syntax-based highlighting of the
interaction buffer using Font Lock mode, as well as a very convenient
interface to the R help system.
</p>
<p>Of course, it also integrates nicely with the mechanisms for editing R
source using Emacs. One can write code in one Emacs buffer and send
whole or parts of it for execution to R; this is helpful for both data
analysis and programming. One can also seamlessly integrate with a
revision control system, in order to maintain a log of changes in your
programs and data, as well as to allow for the retrieval of past
versions of the code.
</p>
<p>In addition, it allows you to keep a record of your session, which can
also be used for error recovery through the use of the transcript mode.
</p>
<p>To specify command line arguments for the inferior R process, use
<kbd>C-u M-x R</kbd> for starting R.
</p>
<hr>
<a name="Debugging-R-from-within-Emacs"></a>
<div class="header">
<p>
Previous: <a href="#Should-I-run-R-from-within-Emacs_003f" accesskey="p" rel="prev">Should I run R from within Emacs?</a>, Up: <a href="#R-and-Emacs" accesskey="u" rel="up">R and Emacs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Debugging-R-from-within-Emacs-1"></a>
<h3 class="section">6.3 Debugging R from within Emacs</h3>
<p>To debug R “from within Emacs”, there are several possibilities. To
use the Emacs GUD (Grand Unified Debugger) library with the recommended
debugger GDB, type <kbd>M-x gdb</kbd> and give the path to the R
<em>binary</em> as argument. At the <code>gdb</code> prompt, set
<code>R_HOME</code> and other environment variables as needed (using e.g.
<kbd>set env R_HOME /path/to/R/</kbd>, but see also below), and start the
binary with the desired arguments (e.g., <kbd>run --quiet</kbd>).
</p>
<p>If you have <acronym>ESS</acronym>, you can do <kbd>C-u M-x R <span class="key">RET</span> - d
<span class="key">SPC</span> g d b <span class="key">RET</span></kbd> to start an inferior R process with arguments
<samp>-d gdb</samp>.
</p>
<p>A third option is to start an inferior R process via <acronym>ESS</acronym>
(<kbd>M-x R</kbd>) and then start GUD (<kbd>M-x gdb</kbd>) giving the R binary
(using its full path name) as the program to debug. Use the program
<code>ps</code> to find the process number of the currently running R
process then use the <code>attach</code> command in gdb to attach it to that
process. One advantage of this method is that you have separate
<code>*R*</code> and <code>*gud-gdb*</code> windows. Within the <code>*R*</code> window
you have all the <acronym>ESS</acronym> facilities, such as object-name
completion, that we know and love.
</p>
<p>When using GUD mode for debugging from within Emacs, you may find it
most convenient to use the directory with your code in it as the current
working directory and then make a symbolic link from that directory to
the R binary. That way <samp>.gdbinit</samp> can stay in the directory with
the code and be used to set up the environment and the search paths for
the source, e.g. as follows:
</p>
<div class="example">
<pre class="example">set env R_HOME /opt/R
set env R_PAPERSIZE letter
set env R_PRINTCMD lpr
dir /opt/R/src/appl
dir /opt/R/src/main
dir /opt/R/src/nmath
dir /opt/R/src/unix
</pre></div>
<hr>
<a name="R-Miscellanea"></a>
<div class="header">
<p>
Next: <a href="#R-Programming" accesskey="n" rel="next">R Programming</a>, Previous: <a href="#R-and-Emacs" accesskey="p" rel="prev">R and Emacs</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Miscellanea-1"></a>
<h2 class="chapter">7 R Miscellanea</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#How-can-I-set-components-of-a-list-to-NULL_003f" accesskey="1">How can I set components of a list to NULL?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-save-my-workspace_003f" accesskey="2">How can I save my workspace?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-clean-up-my-workspace_003f" accesskey="3">How can I clean up my workspace?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f" accesskey="4">How can I get eval() and D() to work?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-do-my-matrices-lose-dimensions_003f" accesskey="5">Why do my matrices lose dimensions?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-does-autoloading-work_003f" accesskey="6">How does autoloading work?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-should-I-set-options_003f" accesskey="7">How should I set options?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-do-file-names-work-in-Windows_003f" accesskey="8">How do file names work in Windows?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-plotting-give-a-color-allocation-error_003f" accesskey="9">Why does plotting give a color allocation error?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-do-I-convert-factors-to-numeric_003f">How do I convert factors to numeric?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Are-Trellis-displays-implemented-in-R_003f">Are Trellis displays implemented in R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-are-the-enclosing-and-parent-environments_003f">What are the enclosing and parent environments?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-substitute-into-a-plot-label_003f">How can I substitute into a plot label?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-are-valid-names_003f">What are valid names?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Are-GAMs-implemented-in-R_003f">Are GAMs implemented in R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f">Why is the output not printed when I source() a file?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-outer_0028_0029-behave-strangely-with-my-function_003f">Why does outer() behave strangely with my function?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f">Why does the output from anova() depend on the order of factors in the model?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-do-I-produce-PNG-graphics-in-batch-mode_003f">How do I produce PNG graphics in batch mode?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-get-command-line-editing-to-work_003f">How can I get command line editing to work?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-turn-a-string-into-a-variable_003f">How can I turn a string into a variable?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-do-lattice_002ftrellis-graphics-not-work_003f">Why do lattice/trellis graphics not work?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-sort-the-rows-of-a-data-frame_003f">How can I sort the rows of a data frame?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f">Why does the help.start() search engine not work?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f">Why did my .Rprofile stop working when I updated R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Where-have-all-the-methods-gone_003f">Where have all the methods gone?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-create-rotated-axis-labels_003f">How can I create rotated axis labels?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-is-read_002etable_0028_0029-so-inefficient_003f">Why is read.table() so inefficient?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#What-is-the-difference-between-package-and-library_003f">What is the difference between package and library?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#I-installed-a-package-but-the-functions-are-not-there">I installed a package but the functions are not there</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-doesn_0027t-R-think-these-numbers-are-equal_003f">Why doesn't R think these numbers are equal?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f">How can I capture or ignore errors in a long simulation?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-are-powers-of-negative-numbers-wrong_003f">Why are powers of negative numbers wrong?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f">How can I save the result of each iteration in a loop into a separate file?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f">Why are p-values not displayed when using lmer()?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-are-there-unwanted-borders">Why are there unwanted borders</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-backslash-behave-strangely-inside-strings_003f">Why does backslash behave strangely inside strings?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f">How can I put error bars or confidence bands on my plot?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-do-I-create-a-plot-with-two-y_002daxes_003f">How do I create a plot with two y-axes?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-do-I-access-the-source-code-for-a-function_003f">How do I access the source code for a function?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f">Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Why-is-R-apparently-not-releasing-memory_003f">Why is R apparently not releasing memory?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-enable-secure-https-downloads-in-R_003f">How can I enable secure https downloads in R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f">How can I get CRAN package binaries for outdated versions of R?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="How-can-I-set-components-of-a-list-to-NULL_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-save-my-workspace_003f" accesskey="n" rel="next">How can I save my workspace?</a>, Previous: <a href="#R-Miscellanea" accesskey="p" rel="prev">R Miscellanea</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-set-components-of-a-list-to-NULL_003f-1"></a>
<h3 class="section">7.1 How can I set components of a list to NULL?</h3>
<p>You can use
</p>
<div class="example">
<pre class="example">x[i] <- list(NULL)
</pre></div>
<p>to set component <code>i</code> of the list <code>x</code> to <code>NULL</code>, similarly
for named components. Do not set <code>x[i]</code> or <code>x[[i]]</code> to
<code>NULL</code>, because this will remove the corresponding component from
the list.
</p>
<p>For dropping the row names of a matrix <code>x</code>, it may be easier to use
<code>rownames(x) <- NULL</code>, similarly for column names.
</p>
<hr>
<a name="How-can-I-save-my-workspace_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-clean-up-my-workspace_003f" accesskey="n" rel="next">How can I clean up my workspace?</a>, Previous: <a href="#How-can-I-set-components-of-a-list-to-NULL_003f" accesskey="p" rel="prev">How can I set components of a list to NULL?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-save-my-workspace_003f-1"></a>
<h3 class="section">7.2 How can I save my workspace?</h3>
<p><code>save.image()</code> saves the objects in the user’s <code>.GlobalEnv</code> to
the file <samp>.RData</samp> in the R startup directory. (This is also what
happens after <kbd>q("yes")</kbd>.) Using <code>save.image(<var>file</var>)</code> one
can save the image under a different name.
</p>
<hr>
<a name="How-can-I-clean-up-my-workspace_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f" accesskey="n" rel="next">How can I get eval() and D() to work?</a>, Previous: <a href="#How-can-I-save-my-workspace_003f" accesskey="p" rel="prev">How can I save my workspace?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-clean-up-my-workspace_003f-1"></a>
<h3 class="section">7.3 How can I clean up my workspace?</h3>
<p>To remove all objects in the currently active environment (typically
<code>.GlobalEnv</code>), you can do
</p>
<div class="example">
<pre class="example">rm(list = ls(all = TRUE))
</pre></div>
<p>(Without <samp>all = TRUE</samp>, only the objects with names not starting
with a ‘<samp>.</samp>’ are removed.)
</p>
<hr>
<a name="How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-do-my-matrices-lose-dimensions_003f" accesskey="n" rel="next">Why do my matrices lose dimensions?</a>, Previous: <a href="#How-can-I-clean-up-my-workspace_003f" accesskey="p" rel="prev">How can I clean up my workspace?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f-1"></a>
<h3 class="section">7.4 How can I get eval() and D() to work?</h3>
<p>Strange things will happen if you use <code>eval(print(x), envir = e)</code>
or <code>D(x^2, "x")</code>. The first one will either tell you that
"<code>x</code>" is not found, or print the value of the wrong <code>x</code>.
The other one will likely return zero if <code>x</code> exists, and an error
otherwise.
</p>
<p>This is because in both cases, the first argument is evaluated in the
calling environment first. The result (which should be an object of
mode <code>"expression"</code> or <code>"call"</code>) is then evaluated or
differentiated. What you (most likely) really want is obtained by
“quoting” the first argument upon surrounding it with
<code>expression()</code>. For example,
</p>
<div class="example">
<pre class="example">R> D(expression(x^2), "x")
2 * x
</pre></div>
<p>Although this behavior may initially seem to be rather strange, it is
perfectly logical. The “intuitive” behavior could easily be
implemented, but problems would arise whenever the expression is
contained in a variable, passed as a parameter, or is the result of a
function call. Consider for instance the semantics in cases like
</p>
<div class="example">
<pre class="example">D2 <- function(e, n) D(D(e, n), n)
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
g(a * b)
</pre></div>
<p>See the help page for <code>deriv()</code> for more examples.
</p>
<hr>
<a name="Why-do-my-matrices-lose-dimensions_003f"></a>
<div class="header">
<p>
Next: <a href="#How-does-autoloading-work_003f" accesskey="n" rel="next">How does autoloading work?</a>, Previous: <a href="#How-can-I-get-eval_0028_0029-and-D_0028_0029-to-work_003f" accesskey="p" rel="prev">How can I get eval() and D() to work?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-do-my-matrices-lose-dimensions_003f-1"></a>
<h3 class="section">7.5 Why do my matrices lose dimensions?</h3>
<p>When a matrix with a single row or column is created by a subscripting
operation, e.g., <code>row <- mat[2, ]</code>, it is by default turned into a
vector. In a similar way if an array with dimension, say, 2 x 3 x 1 x 4<!-- /@w --> is created by subscripting it will be coerced into a 2 x 3 x 4<!-- /@w -->
array, losing the unnecessary dimension. After much discussion this has
been determined to be a <em>feature</em>.
</p>
<p>To prevent this happening, add the option <samp>drop = FALSE</samp> to the
subscripting. For example,
</p>
<div class="example">
<pre class="example">rowmatrix <- mat[2, , drop = FALSE] # <span class="roman">creates a row matrix</span>
colmatrix <- mat[, 2, drop = FALSE] # <span class="roman">creates a column matrix</span>
a <- b[1, 1, 1, drop = FALSE] # <span class="roman">creates a 1 x 1 x 1 array</span>
</pre></div>
<p>The <samp>drop = FALSE</samp> option should be used defensively when
programming. For example, the statement
</p>
<div class="example">
<pre class="example">somerows <- mat[index, ]
</pre></div>
<p>will return a vector rather than a matrix if <code>index</code> happens to
have length 1, causing errors later in the code. It should probably be
rewritten as
</p>
<div class="example">
<pre class="example">somerows <- mat[index, , drop = FALSE]
</pre></div>
<hr>
<a name="How-does-autoloading-work_003f"></a>
<div class="header">
<p>
Next: <a href="#How-should-I-set-options_003f" accesskey="n" rel="next">How should I set options?</a>, Previous: <a href="#Why-do-my-matrices-lose-dimensions_003f" accesskey="p" rel="prev">Why do my matrices lose dimensions?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-does-autoloading-work_003f-1"></a>
<h3 class="section">7.6 How does autoloading work?</h3>
<p>R has a special environment called <code>.AutoloadEnv</code>. Using
<kbd>autoload(<var>name</var>, <var>pkg</var>)</kbd>, where <var>name</var> and
<var>pkg</var> are strings giving the names of an object and the package
containing it, stores some information in this environment. When R
tries to evaluate <var>name</var>, it loads the corresponding package
<var>pkg</var> and reevaluates <var>name</var> in the new package’s
environment.
</p>
<p>Using this mechanism makes R behave as if the package was loaded, but
does not occupy memory (yet).
</p>
<p>See the help page for <code>autoload()</code> for a very nice example.
</p>
<hr>
<a name="How-should-I-set-options_003f"></a>
<div class="header">
<p>
Next: <a href="#How-do-file-names-work-in-Windows_003f" accesskey="n" rel="next">How do file names work in Windows?</a>, Previous: <a href="#How-does-autoloading-work_003f" accesskey="p" rel="prev">How does autoloading work?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-should-I-set-options_003f-1"></a>
<h3 class="section">7.7 How should I set options?</h3>
<p>The function <code>options()</code> allows setting and examining a variety of
global “options” which affect the way in which R computes and displays
its results. The variable <code>.Options</code> holds the current values of
these options, but should never directly be assigned to unless you want
to drive yourself crazy—simply pretend that it is a “read-only”
variable.
</p>
<p>For example, given
</p>
<div class="example">
<pre class="example">test1 <- function(x = pi, dig = 3) {
oo <- options(digits = dig); on.exit(options(oo));
cat(.Options$digits, x, "\n")
}
test2 <- function(x = pi, dig = 3) {
.Options$digits <- dig
cat(.Options$digits, x, "\n")
}
</pre></div>
<p>we obtain:
</p>
<div class="example">
<pre class="example">R> test1()
3 3.14
R> test2()
3 3.141593
</pre></div>
<p>What is really used is the <em>global</em> value of <code>.Options</code>, and
using <kbd>options(OPT = VAL)</kbd> correctly updates it. Local copies of
<code>.Options</code>, either in <code>.GlobalEnv</code> or in a function
environment (frame), are just silently disregarded.
</p>
<hr>
<a name="How-do-file-names-work-in-Windows_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-does-plotting-give-a-color-allocation-error_003f" accesskey="n" rel="next">Why does plotting give a color allocation error?</a>, Previous: <a href="#How-should-I-set-options_003f" accesskey="p" rel="prev">How should I set options?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-do-file-names-work-in-Windows_003f-1"></a>
<h3 class="section">7.8 How do file names work in Windows?</h3>
<p>As R uses C-style string handling, ‘<samp>\</samp>’ is treated as an escape
character, so that for example one can enter a newline as ‘<samp>\n</samp>’.
When you really need a ‘<samp>\</samp>’, you have to escape it with another
‘<samp>\</samp>’.
</p>
<p>Thus, in filenames use something like <code>"c:\\data\\money.dat"</code>. You
can also replace ‘<samp>\</samp>’ by ‘<samp>/</samp>’ (<code>"c:/data/money.dat"</code>).
</p>
<hr>
<a name="Why-does-plotting-give-a-color-allocation-error_003f"></a>
<div class="header">
<p>
Next: <a href="#How-do-I-convert-factors-to-numeric_003f" accesskey="n" rel="next">How do I convert factors to numeric?</a>, Previous: <a href="#How-do-file-names-work-in-Windows_003f" accesskey="p" rel="prev">How do file names work in Windows?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-plotting-give-a-color-allocation-error_003f-1"></a>
<h3 class="section">7.9 Why does plotting give a color allocation error?</h3>
<p>On an X11 device, plotting sometimes, e.g., when running
<code>demo("image")</code>, results in “Error: color allocation error”.
This is an X problem, and only indirectly related to R. It occurs when
applications started prior to R have used all the available colors.
(How many colors are available depends on the X configuration; sometimes
only 256 colors can be used.)
</p>
<p>One application which is notorious for “eating” colors is Netscape.
If the problem occurs when Netscape is running, try (re)starting it with
either the <samp>-no-install</samp> (to use the default colormap) or the
<samp>-install</samp> (to install a private colormap) option.
</p>
<p>You could also set the <code>colortype</code> of <code>X11()</code> to
<code>"pseudo.cube"</code> rather than the default <code>"pseudo"</code>. See the
help page for <code>X11()</code> for more information.
</p>
<hr>
<a name="How-do-I-convert-factors-to-numeric_003f"></a>
<div class="header">
<p>
Next: <a href="#Are-Trellis-displays-implemented-in-R_003f" accesskey="n" rel="next">Are Trellis displays implemented in R?</a>, Previous: <a href="#Why-does-plotting-give-a-color-allocation-error_003f" accesskey="p" rel="prev">Why does plotting give a color allocation error?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-do-I-convert-factors-to-numeric_003f-1"></a>
<h3 class="section">7.10 How do I convert factors to numeric?</h3>
<p>It may happen that when reading numeric data into R (usually, when
reading in a file), they come in as factors. If <code>f</code> is such a
factor object, you can use
</p>
<div class="example">
<pre class="example">as.numeric(as.character(f))
</pre></div>
<p>to get the numbers back. More efficient, but harder to remember, is
</p>
<div class="example">
<pre class="example">as.numeric(levels(f))[as.integer(f)]
</pre></div>
<p>In any case, do not call <code>as.numeric()</code> or their likes directly for
the task at hand (as <code>as.numeric()</code> or <code>unclass()</code> give the
internal codes).
</p>
<hr>
<a name="Are-Trellis-displays-implemented-in-R_003f"></a>
<div class="header">
<p>
Next: <a href="#What-are-the-enclosing-and-parent-environments_003f" accesskey="n" rel="next">What are the enclosing and parent environments?</a>, Previous: <a href="#How-do-I-convert-factors-to-numeric_003f" accesskey="p" rel="prev">How do I convert factors to numeric?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Are-Trellis-displays-implemented-in-R_003f-1"></a>
<h3 class="section">7.11 Are Trellis displays implemented in R?</h3>
<p>The recommended package <a href="https://CRAN.R-project.org/package=lattice"><strong>lattice</strong></a> (which is based on base
package <strong>grid</strong>) provides graphical functionality that is compatible
with most Trellis commands.
</p>
<p>You could also look at <code>coplot()</code> and <code>dotchart()</code> which might
do at least some of what you want. Note also that the R version of
<code>pairs()</code> is fairly general and provides most of the functionality
of <code>splom()</code>, and that R’s default plot method has an argument
<code>asp</code> allowing to specify (and fix against device resizing) the
aspect ratio of the plot.
</p>
<p>(Because the word “Trellis” has been claimed as a trademark we do not
use it in R. The name “lattice” has been chosen for the R
equivalent.)
</p>
<hr>
<a name="What-are-the-enclosing-and-parent-environments_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-substitute-into-a-plot-label_003f" accesskey="n" rel="next">How can I substitute into a plot label?</a>, Previous: <a href="#Are-Trellis-displays-implemented-in-R_003f" accesskey="p" rel="prev">Are Trellis displays implemented in R?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-are-the-enclosing-and-parent-environments_003f-1"></a>
<h3 class="section">7.12 What are the enclosing and parent environments?</h3>
<p>Inside a function you may want to access variables in two additional
environments: the one that the function was defined in (“enclosing”),
and the one it was invoked in (“parent”).
</p>
<p>If you create a function at the command line or load it in a package its
enclosing environment is the global workspace. If you define a function
<code>f()</code> inside another function <code>g()</code> its enclosing environment
is the environment inside <code>g()</code>. The enclosing environment for a
function is fixed when the function is created. You can find out the
enclosing environment for a function <code>f()</code> using
<code>environment(f)</code>.
</p>
<p>The “parent” environment, on the other hand, is defined when you
invoke a function. If you invoke <code>lm()</code> at the command line its
parent environment is the global workspace, if you invoke it inside a
function <code>f()</code> then its parent environment is the environment
inside <code>f()</code>. You can find out the parent environment for an
invocation of a function by using <code>parent.frame()</code> or
<code>sys.frame(sys.parent())</code>.
</p>
<p>So for most user-visible functions the enclosing environment will be the
global workspace, since that is where most functions are defined. The
parent environment will be wherever the function happens to be called
from. If a function <code>f()</code> is defined inside another function
<code>g()</code> it will probably be used inside <code>g()</code> as well, so its
parent environment and enclosing environment will probably be the same.
</p>
<p>Parent environments are important because things like model formulas
need to be evaluated in the environment the function was called from,
since that’s where all the variables will be available. This relies on
the parent environment being potentially different with each invocation.
</p>
<p>Enclosing environments are important because a function can use
variables in the enclosing environment to share information with other
functions or with other invocations of itself (see the section on
lexical scoping). This relies on the enclosing environment being the
same each time the function is invoked. (In C this would be done with
static variables.)
</p>
<p>Scoping <em>is</em> hard. Looking at examples helps. It is particularly
instructive to look at examples that work differently in R and S and try
to see why they differ. One way to describe the scoping differences
between R and S is to say that in S the enclosing environment is
<em>always</em> the global workspace, but in R the enclosing environment
is wherever the function was created.
</p>
<hr>
<a name="How-can-I-substitute-into-a-plot-label_003f"></a>
<div class="header">
<p>
Next: <a href="#What-are-valid-names_003f" accesskey="n" rel="next">What are valid names?</a>, Previous: <a href="#What-are-the-enclosing-and-parent-environments_003f" accesskey="p" rel="prev">What are the enclosing and parent environments?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-substitute-into-a-plot-label_003f-1"></a>
<h3 class="section">7.13 How can I substitute into a plot label?</h3>
<p>Often, it is desired to use the value of an R object in a plot label,
e.g., a title. This is easily accomplished using <code>paste()</code> if the
label is a simple character string, but not always obvious in case the
label is an expression (for refined mathematical annotation). In such a
case, either use <code>parse()</code> on your pasted character string or use
<code>substitute()</code> on an expression. For example, if <code>ahat</code> is an
estimator of your parameter <em>a</em> of interest, use
</p>
<div class="example">
<pre class="example">title(substitute(hat(a) == ahat, list(ahat = ahat)))
</pre></div>
<p>(note that it is ‘<samp>==</samp>’ and not ‘<samp>=</samp>’). Sometimes <code>bquote()</code>
gives a more compact form, e.g.,
</p>
<div class="example">
<pre class="example">title(bquote(hat(a) = .(ahat)))
</pre></div>
<p>where subexpressions enclosed in ‘<samp>.()</samp>’ are replaced by their
values.
</p>
<p>There are more examples in the mailing list archives.
</p>
<hr>
<a name="What-are-valid-names_003f"></a>
<div class="header">
<p>
Next: <a href="#Are-GAMs-implemented-in-R_003f" accesskey="n" rel="next">Are GAMs implemented in R?</a>, Previous: <a href="#How-can-I-substitute-into-a-plot-label_003f" accesskey="p" rel="prev">How can I substitute into a plot label?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-are-valid-names_003f-1"></a>
<h3 class="section">7.14 What are valid names?</h3>
<p>When creating data frames using <code>data.frame()</code> or
<code>read.table()</code>, R by default ensures that the variable names are
syntactically valid. (The argument <samp>check.names</samp> to these
functions controls whether variable names are checked and adjusted by
<code>make.names()</code> if needed.)
</p>
<p>To understand what names are “valid”, one needs to take into account
that the term “name” is used in several different (but related) ways
in the language:
</p>
<ol>
<li> A <em>syntactic name</em> is a string the parser interprets as this type
of expression. It consists of letters, numbers, and the dot and (for
versions of R at least 1.9.0) underscore characters, and starts with
either a letter or a dot not followed by a number. Reserved words are
not syntactic names.
</li><li> An <em>object name</em> is a string associated with an object that is
assigned in an expression either by having the object name on the left
of an assignment operation or as an argument to the <code>assign()</code>
function. It is usually a syntactic name as well, but can be any
non-empty string if it is quoted (and it is always quoted in the call to
<code>assign()</code>).
</li><li> An <em>argument name</em> is what appears to the left of the equals sign
when supplying an argument in a function call (for example,
<code>f(trim=.5)</code>). Argument names are also usually syntactic names,
but again can be anything if they are quoted.
</li><li> An <em>element name</em> is a string that identifies a piece of an object
(a component of a list, for example.) When it is used on the right of
the ‘<samp>$</samp>’ operator, it must be a syntactic name, or quoted.
Otherwise, element names can be any strings. (When an object is used as
a database, as in a call to <code>eval()</code> or <code>attach()</code>, the
element names become object names.)
</li><li> Finally, a <em>file name</em> is a string identifying a file in the
operating system for reading, writing, etc. It really has nothing much
to do with names in the language, but it is traditional to call these
strings file “names”.
</li></ol>
<hr>
<a name="Are-GAMs-implemented-in-R_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f" accesskey="n" rel="next">Why is the output not printed when I source() a file?</a>, Previous: <a href="#What-are-valid-names_003f" accesskey="p" rel="prev">What are valid names?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Are-GAMs-implemented-in-R_003f-1"></a>
<h3 class="section">7.15 Are GAMs implemented in R?</h3>
<p>Package <a href="https://CRAN.R-project.org/package=gam"><strong>gam</strong></a> from <acronym>CRAN</acronym> implements all the Generalized
Additive Models (GAM) functionality as described in the GAM chapter of
the White Book. In particular, it implements backfitting with both
local regression and smoothing splines, and is extendable. There is a
<code>gam()</code> function for GAMs in package <a href="https://CRAN.R-project.org/package=mgcv"><strong>mgcv</strong></a>, but it is not
an exact clone of what is described in the White Book (no <code>lo()</code>
for example). Package <a href="https://CRAN.R-project.org/package=gss"><strong>gss</strong></a> can fit spline-based GAMs too. And
if you can accept regression splines you can use <code>glm()</code>. For
Gaussian GAMs you can use <code>bruto()</code> from package <a href="https://CRAN.R-project.org/package=mda"><strong>mda</strong></a>.
</p>
<hr>
<a name="Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-does-outer_0028_0029-behave-strangely-with-my-function_003f" accesskey="n" rel="next">Why does outer() behave strangely with my function?</a>, Previous: <a href="#Are-GAMs-implemented-in-R_003f" accesskey="p" rel="prev">Are GAMs implemented in R?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f-1"></a>
<h3 class="section">7.16 Why is the output not printed when I source() a file?</h3>
<p>Most R commands do not generate any output. The command
</p>
<div class="example">
<pre class="example">1+1
</pre></div>
<p>computes the value 2 and returns it; the command
</p>
<div class="example">
<pre class="example">summary(glm(y~x+z, family=binomial))
</pre></div>
<p>fits a logistic regression model, computes some summary information and
returns an object of class <code>"summary.glm"</code> (see <a href="#How-should-I-write-summary-methods_003f">How should I write summary methods?</a>).
</p>
<p>If you type ‘<samp>1+1</samp>’ or ‘<samp>summary(glm(y~x+z, family=binomial))</samp>’ at
the command line the returned value is automatically printed (unless it
is <code>invisible()</code>), but in other circumstances, such as in a
<code>source()</code>d file or inside a function it isn’t printed unless you
specifically print it.
</p>
<p>To print the value use
</p>
<div class="example">
<pre class="example">print(1+1)
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">print(summary(glm(y~x+z, family=binomial)))
</pre></div>
<p>instead, or use <code>source(<var>file</var>, echo=TRUE)</code>.
</p>
<hr>
<a name="Why-does-outer_0028_0029-behave-strangely-with-my-function_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f" accesskey="n" rel="next">Why does the output from anova() depend on the order of factors in the model?</a>, Previous: <a href="#Why-is-the-output-not-printed-when-I-source_0028_0029-a-file_003f" accesskey="p" rel="prev">Why is the output not printed when I source() a file?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-outer_0028_0029-behave-strangely-with-my-function_003f-1"></a>
<h3 class="section">7.17 Why does outer() behave strangely with my function?</h3>
<p>As the help for <code>outer()</code> indicates, it does not work on arbitrary
functions the way the <code>apply()</code> family does. It requires functions
that are vectorized to work elementwise on arrays. As you can see by
looking at the code, <code>outer(x, y, FUN)</code> creates two large vectors
containing every possible combination of elements of <code>x</code> and
<code>y</code> and then passes this to <code>FUN</code> all at once. Your function
probably cannot handle two large vectors as parameters.
</p>
<p>If you have a function that cannot handle two vectors but can handle two
scalars, then you can still use <code>outer()</code> but you will need to wrap
your function up first, to simulate vectorized behavior. Suppose your
function is
</p>
<div class="example">
<pre class="example">foo <- function(x, y, happy) {
stopifnot(length(x) == 1, length(y) == 1) # scalars only!
(x + y) * happy
}
</pre></div>
<p>If you define the general function
</p>
<div class="example">
<pre class="example">wrapper <- function(x, y, my.fun, ...) {
sapply(seq_along(x), FUN = function(i) my.fun(x[i], y[i], ...))
}
</pre></div>
<p>then you can use <code>outer()</code> by writing, e.g.,
</p>
<div class="example">
<pre class="example">outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
</pre></div>
<p>Scalar functions can also be vectorized using <code>Vectorize()</code>.
</p>
<hr>
<a name="Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f"></a>
<div class="header">
<p>
Next: <a href="#How-do-I-produce-PNG-graphics-in-batch-mode_003f" accesskey="n" rel="next">How do I produce PNG graphics in batch mode?</a>, Previous: <a href="#Why-does-outer_0028_0029-behave-strangely-with-my-function_003f" accesskey="p" rel="prev">Why does outer() behave strangely with my function?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f-1"></a>
<h3 class="section">7.18 Why does the output from anova() depend on the order of factors in the model?</h3>
<p>In a model such as <code>~A+B+A:B</code>, R will report the difference in sums
of squares between the models <code>~1</code>, <code>~A</code>, <code>~A+B</code> and
<code>~A+B+A:B</code>. If the model were <code>~B+A+A:B</code>, R would report
differences between <code>~1</code>, <code>~B</code>, <code>~A+B</code>, and
<code>~A+B+A:B</code> . In the first case the sum of squares for <code>A</code> is
comparing <code>~1</code> and <code>~A</code>, in the second case it is comparing
<code>~B</code> and <code>~B+A</code>. In a non-orthogonal design (i.e., most
unbalanced designs) these comparisons are (conceptually and numerically)
different.
</p>
<p>Some packages report instead the sums of squares based on comparing the
full model to the models with each factor removed one at a time (the
famous ‘Type III sums of squares’ from SAS, for example). These do not
depend on the order of factors in the model. The question of which set
of sums of squares is the Right Thing provokes low-level holy wars on
R-help from time to time.
</p>
<p>There is no need to be agitated about the particular sums of squares
that R reports. You can compute your favorite sums of squares quite
easily. Any two models can be compared with <code>anova(<var>model1</var>,
<var>model2</var>)</code>, and <code>drop1(<var>model1</var>)</code> will show the sums of
squares resulting from dropping single terms.
</p>
<hr>
<a name="How-do-I-produce-PNG-graphics-in-batch-mode_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-get-command-line-editing-to-work_003f" accesskey="n" rel="next">How can I get command line editing to work?</a>, Previous: <a href="#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f" accesskey="p" rel="prev">Why does the output from anova() depend on the order of factors in the model?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-do-I-produce-PNG-graphics-in-batch-mode_003f-1"></a>
<h3 class="section">7.19 How do I produce PNG graphics in batch mode?</h3>
<p>Under a Unix-like, if your installation supports the
<code>type="cairo"</code> option to the <code>png()</code> device there should be no
problems, and the default settings should just work. This option is not
available for versions of R prior to 2.7.0, or without support for
cairo. From R 2.7.0 <code>png()</code> by default uses the Quartz device
on macOS, and that too works in batch mode.
</p>
<p>Earlier versions of the <code>png()</code> device used the X11 driver, which
is a problem in batch mode or for remote operation. If you have
Ghostscript you can use <code>bitmap()</code>, which produces a PostScript or
PDF file then converts it to any bitmap format supported by Ghostscript.
On some installations this produces ugly output, on others it is
perfectly satisfactory. Many systems now come with Xvfb from
<a href="http://www.x.org/">X.Org</a> (possibly as an optional
install), which is an X11 server that does not require a screen; and
there is the <a href="https://CRAN.R-project.org/package=GDD"><strong>GDD</strong></a> package from <acronym>CRAN</acronym>, which produces PNG,
JPEG and GIF bitmaps without X11.
</p>
<hr>
<a name="How-can-I-get-command-line-editing-to-work_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-turn-a-string-into-a-variable_003f" accesskey="n" rel="next">How can I turn a string into a variable?</a>, Previous: <a href="#How-do-I-produce-PNG-graphics-in-batch-mode_003f" accesskey="p" rel="prev">How do I produce PNG graphics in batch mode?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-get-command-line-editing-to-work_003f-1"></a>
<h3 class="section">7.20 How can I get command line editing to work?</h3>
<p>The Unix-like command-line interface to R can only provide the inbuilt
command line editor which allows recall, editing and re-submission of
prior commands provided that the <acronym>GNU</acronym> readline library is
available at the time R is configured for compilation. Note that the
‘development’ version of readline including the appropriate headers is
needed: users of Linux binary distributions will need to install
packages such as <code>libreadline-dev</code> (Debian) or
<code>readline-devel</code> (Red Hat).
</p>
<hr>
<a name="How-can-I-turn-a-string-into-a-variable_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-do-lattice_002ftrellis-graphics-not-work_003f" accesskey="n" rel="next">Why do lattice/trellis graphics not work?</a>, Previous: <a href="#How-can-I-get-command-line-editing-to-work_003f" accesskey="p" rel="prev">How can I get command line editing to work?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-turn-a-string-into-a-variable_003f-1"></a>
<h3 class="section">7.21 How can I turn a string into a variable?</h3>
<p>If you have
</p>
<div class="example">
<pre class="example">varname <- c("a", "b", "d")
</pre></div>
<p>you can do
</p>
<div class="example">
<pre class="example">get(varname[1]) + 2
</pre></div>
<p>for
</p>
<div class="example">
<pre class="example">a + 2
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">assign(varname[1], 2 + 2)
</pre></div>
<p>for
</p>
<div class="example">
<pre class="example">a <- 2 + 2
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">eval(substitute(lm(y ~ x + variable),
list(variable = as.name(varname[1]))))
</pre></div>
<p>for
</p>
<div class="example">
<pre class="example">lm(y ~ x + a)
</pre></div>
<p>At least in the first two cases it is often easier to just use a list,
and then you can easily index it by name
</p>
<div class="example">
<pre class="example">vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
vars[["a"]]
</pre></div>
<p>without any of this messing about.
</p>
<hr>
<a name="Why-do-lattice_002ftrellis-graphics-not-work_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-sort-the-rows-of-a-data-frame_003f" accesskey="n" rel="next">How can I sort the rows of a data frame?</a>, Previous: <a href="#How-can-I-turn-a-string-into-a-variable_003f" accesskey="p" rel="prev">How can I turn a string into a variable?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-do-lattice_002ftrellis-graphics-not-work_003f-1"></a>
<h3 class="section">7.22 Why do lattice/trellis graphics not work?</h3>
<p>The most likely reason is that you forgot to tell R to display the
graph. Lattice functions such as <code>xyplot()</code> create a graph object,
but do not display it (the same is true of <a href="https://CRAN.R-project.org/package=ggplot2"><strong>ggplot2</strong></a> graphics,
and Trellis graphics in <small>S-PLUS</small>). The <code>print()</code> method for the
graph object produces the actual display. When you use these functions
interactively at the command line, the result is automatically printed,
but in <code>source()</code> or inside your own functions you will need an
explicit <code>print()</code> statement.
</p>
<hr>
<a name="How-can-I-sort-the-rows-of-a-data-frame_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f" accesskey="n" rel="next">Why does the help.start() search engine not work?</a>, Previous: <a href="#Why-do-lattice_002ftrellis-graphics-not-work_003f" accesskey="p" rel="prev">Why do lattice/trellis graphics not work?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-sort-the-rows-of-a-data-frame_003f-1"></a>
<h3 class="section">7.23 How can I sort the rows of a data frame?</h3>
<p>To sort the rows within a data frame, with respect to the values in one
or more of the columns, simply use <code>order()</code> (e.g.,
<code>DF[order(DF$a, DF[["b"]]), ]</code> to sort the data frame <code>DF</code> on
columns named <code>a</code> and <code>b</code>).
</p>
<hr>
<a name="Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f" accesskey="n" rel="next">Why did my .Rprofile stop working when I updated R?</a>, Previous: <a href="#How-can-I-sort-the-rows-of-a-data-frame_003f" accesskey="p" rel="prev">How can I sort the rows of a data frame?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f-1"></a>
<h3 class="section">7.24 Why does the help.start() search engine not work?</h3>
<p>The browser-based search engine in <code>help.start()</code> utilizes a Java
applet. In order for this to function properly, a compatible version of
Java must installed on your system and linked to your browser, and both
Java <em>and</em> JavaScript need to be enabled in your browser.
</p>
<p>There have been a number of compatibility issues with versions of Java
and of browsers.
See <a href="http://cran.r-project.org/doc/manuals/R-admin.html#Enabling-search-in-HTML-help">Enabling search in HTML help</a> in <cite>R Installation and Administration</cite>, for further details.
</p>
<hr>
<a name="Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f"></a>
<div class="header">
<p>
Next: <a href="#Where-have-all-the-methods-gone_003f" accesskey="n" rel="next">Where have all the methods gone?</a>, Previous: <a href="#Why-does-the-help_002estart_0028_0029-search-engine-not-work_003f" accesskey="p" rel="prev">Why does the help.start() search engine not work?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f-1"></a>
<h3 class="section">7.25 Why did my .Rprofile stop working when I updated R?</h3>
<p>Did you read the <samp>NEWS</samp> file? For functions that are not in the
<strong>base</strong> package you need to specify the correct package namespace,
since the code will be run <em>before</em> the packages are loaded. E.g.,
</p>
<div class="example">
<pre class="example">ps.options(horizontal = FALSE)
help.start()
</pre></div>
<p>needs to be
</p>
<div class="example">
<pre class="example">grDevices::ps.options(horizontal = FALSE)
utils::help.start()
</pre></div>
<p>(<code>graphics::ps.options(horizontal = FALSE)</code> in R 1.9.x).
</p>
<hr>
<a name="Where-have-all-the-methods-gone_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-create-rotated-axis-labels_003f" accesskey="n" rel="next">How can I create rotated axis labels?</a>, Previous: <a href="#Why-did-my-_002eRprofile-stop-working-when-I-updated-R_003f" accesskey="p" rel="prev">Why did my .Rprofile stop working when I updated R?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Where-have-all-the-methods-gone_003f-1"></a>
<h3 class="section">7.26 Where have all the methods gone?</h3>
<p>Many functions, particularly S3 methods, are now hidden in namespaces.
This has the advantage that they cannot be called inadvertently with
arguments of the wrong class, but it makes them harder to view.
</p>
<p>To see the code for an S3 method (e.g., <code>[.terms</code>) use
</p>
<div class="example">
<pre class="example">getS3method("[", "terms")
</pre></div>
<p>To see the code for an unexported function <code>foo()</code> in the namespace
of package <code>"bar"</code> use <code>bar:::foo</code>. Don’t use these
constructions to call unexported functions in your own code—they are
probably unexported for a reason and may change without warning.
</p>
<hr>
<a name="How-can-I-create-rotated-axis-labels_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-is-read_002etable_0028_0029-so-inefficient_003f" accesskey="n" rel="next">Why is read.table() so inefficient?</a>, Previous: <a href="#Where-have-all-the-methods-gone_003f" accesskey="p" rel="prev">Where have all the methods gone?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-create-rotated-axis-labels_003f-1"></a>
<h3 class="section">7.27 How can I create rotated axis labels?</h3>
<p>To rotate axis labels (using base graphics), you need to use
<code>text()</code>, rather than <code>mtext()</code>, as the latter does not
support <code>par("srt")</code>.
</p>
<div class="example">
<pre class="example">## <span class="roman">Increase bottom margin to make room for rotated labels</span>
par(mar = c(7, 4, 4, 2) + 0.1)
## <span class="roman">Create plot with no x axis and no x axis label</span>
plot(1 : 8, xaxt = "n", xlab = "")
## <span class="roman">Set up x axis with tick marks alone</span>
axis(1, labels = FALSE)
## <span class="roman">Create some text labels</span>
labels <- paste("Label", 1:8, sep = " ")
## <span class="roman">Plot x axis labels at default tick marks</span>
text(1:8, par("usr")[3] - 0.25, srt = 45, adj = 1,
labels = labels, xpd = TRUE)
## <span class="roman">Plot x axis label at line 6 (of 7)</span>
mtext(1, text = "X Axis Label", line = 6)
</pre></div>
<p>When plotting the x axis labels, we use <code>srt = 45</code> for text
rotation angle, <code>adj = 1</code> to place the right end of text at the
tick marks, and <code>xpd = TRUE</code> to allow for text outside the plot
region. You can adjust the value of the <code>0.25</code> offset as required
to move the axis labels up or down relative to the x axis. See
<code>?par</code> for more information.
</p>
<p>Also see Figure 1 and associated code in Paul Murrell (2003),
“Integrating grid Graphics Output with Base Graphics Output”,
<em>R News</em>, <strong>3/2</strong>, 7–12.
</p>
<hr>
<a name="Why-is-read_002etable_0028_0029-so-inefficient_003f"></a>
<div class="header">
<p>
Next: <a href="#What-is-the-difference-between-package-and-library_003f" accesskey="n" rel="next">What is the difference between package and library?</a>, Previous: <a href="#How-can-I-create-rotated-axis-labels_003f" accesskey="p" rel="prev">How can I create rotated axis labels?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-is-read_002etable_0028_0029-so-inefficient_003f-1"></a>
<h3 class="section">7.28 Why is read.table() so inefficient?</h3>
<p>By default, <code>read.table()</code> needs to read in everything as character
data, and then try to figure out which variables to convert to numerics
or factors. For a large data set, this takes considerable amounts of
time and memory. Performance can substantially be improved by using the
<code>colClasses</code> argument to specify the classes to be assumed for the
columns of the table.
</p>
<hr>
<a name="What-is-the-difference-between-package-and-library_003f"></a>
<div class="header">
<p>
Next: <a href="#I-installed-a-package-but-the-functions-are-not-there" accesskey="n" rel="next">I installed a package but the functions are not there</a>, Previous: <a href="#Why-is-read_002etable_0028_0029-so-inefficient_003f" accesskey="p" rel="prev">Why is read.table() so inefficient?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-the-difference-between-package-and-library_003f-1"></a>
<h3 class="section">7.29 What is the difference between package and library?</h3>
<p>A <em>package</em> is a standardized collection of material extending R,
e.g. providing code, data, or documentation. A <em>library</em> is a
place (directory) where R knows to find packages it can use (i.e., which
were <em>installed</em>). R is told to use a package (to “load” it and
add it to the search path) via calls to the function <code>library</code>.
I.e., <code>library()</code> is employed to load a package from libraries
containing packages.
</p>
<p>See <a href="#R-Add_002dOn-Packages">R Add-On Packages</a>, for more details. See also Uwe Ligges (2003),
“R Help Desk: Package Management”, <em>R News</em>, <strong>3/3</strong>,
37–39.
</p>
<hr>
<a name="I-installed-a-package-but-the-functions-are-not-there"></a>
<div class="header">
<p>
Next: <a href="#Why-doesn_0027t-R-think-these-numbers-are-equal_003f" accesskey="n" rel="next">Why doesn't R think these numbers are equal?</a>, Previous: <a href="#What-is-the-difference-between-package-and-library_003f" accesskey="p" rel="prev">What is the difference between package and library?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="I-installed-a-package-but-the-functions-are-not-there-1"></a>
<h3 class="section">7.30 I installed a package but the functions are not there</h3>
<p>To actually <em>use</em> the package, it needs to be <em>loaded</em> using
<code>library()</code>.
</p>
<p>See <a href="#R-Add_002dOn-Packages">R Add-On Packages</a> and <a href="#What-is-the-difference-between-package-and-library_003f">What is the difference between package and library?</a> for more information.
</p>
<hr>
<a name="Why-doesn_0027t-R-think-these-numbers-are-equal_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f" accesskey="n" rel="next">How can I capture or ignore errors in a long simulation?</a>, Previous: <a href="#I-installed-a-package-but-the-functions-are-not-there" accesskey="p" rel="prev">I installed a package but the functions are not there</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-doesn_0027t-R-think-these-numbers-are-equal_003f-1"></a>
<h3 class="section">7.31 Why doesn’t R think these numbers are equal?</h3>
<p>The only numbers that can be represented exactly in R’s numeric type are
integers and fractions whose denominator is a power of 2. All other
numbers are internally rounded to (typically) 53 binary digits accuracy.
As a result, two floating point numbers will not reliably be equal
unless they have been computed by the same algorithm, and not always
even then. For example
</p>
<div class="example">
<pre class="example">R> a <- sqrt(2)
R> a * a == 2
[1] FALSE
R> a * a - 2
[1] 4.440892e-16
R> print(a * a, digits = 18)
[1] 2.00000000000000044
</pre></div>
<p>The function <code>all.equal()</code> compares two objects using a numeric
tolerance of <code>.Machine$double.eps ^ 0.5</code>. If you want much greater
accuracy than this you will need to consider error propagation
carefully.
</p>
<p>A discussion with many easily followed examples is in Appendix G
“Computational Precision and Floating Point Arithmetic”, pages
753–771 of <em>Statistical Analysis and Data Display: An Intermediate
Course with Examples in R</em>, Richard M. Heiberger and Burt Holland
(Springer 2015, second edition). This appendix is a free download from
<a href="http://link.springer.com/content/pdf/bbm%3A978-1-4939-2122-5%2F1.pdf">http://link.springer.com/content/pdf/bbm%3A978-1-4939-2122-5%2F1.pdf</a>.
</p>
<p>For more information, see e.g. David Goldberg (1991), “What Every
Computer Scientist Should Know About Floating-Point Arithmetic”,
<em>ACM Computing Surveys</em>, <strong>23/1</strong>, 5–48, also available via
<a href="http://www.validlab.com/goldberg/paper.pdf">http://www.validlab.com/goldberg/paper.pdf</a>.
</p>
<p>Here is another example, this time using addition:
</p>
<div class="example">
<pre class="example">R> .3 + .6 == .9
[1] FALSE
R> .3 + .6 - .9
[1] -1.110223e-16
R> print(matrix(c(.3, .6, .9, .3 + .6)), digits = 18)
[,1]
[1,] 0.299999999999999989
[2,] 0.599999999999999978
[3,] 0.900000000000000022
[4,] 0.899999999999999911
</pre></div>
<hr>
<a name="How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-are-powers-of-negative-numbers-wrong_003f" accesskey="n" rel="next">Why are powers of negative numbers wrong?</a>, Previous: <a href="#Why-doesn_0027t-R-think-these-numbers-are-equal_003f" accesskey="p" rel="prev">Why doesn't R think these numbers are equal?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f-1"></a>
<h3 class="section">7.32 How can I capture or ignore errors in a long simulation?</h3>
<p>Use <code>try()</code>, which returns an object of class <code>"try-error"</code>
instead of an error, or preferably <code>tryCatch()</code>, where the return
value can be configured more flexibly. For example
</p>
<div class="example">
<pre class="example">beta[i,] <- tryCatch(coef(lm(formula, data)),
error = function(e) rep(NaN, 4))
</pre></div>
<p>would return the coefficients if the <code>lm()</code> call succeeded and
would return <code>c(NaN, NaN, NaN, NaN)</code> if it failed (presumably there
are supposed to be 4 coefficients in this example).
</p>
<hr>
<a name="Why-are-powers-of-negative-numbers-wrong_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f" accesskey="n" rel="next">How can I save the result of each iteration in a loop into a separate file?</a>, Previous: <a href="#How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f" accesskey="p" rel="prev">How can I capture or ignore errors in a long simulation?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-are-powers-of-negative-numbers-wrong_003f-1"></a>
<h3 class="section">7.33 Why are powers of negative numbers wrong?</h3>
<p>You are probably seeing something like
</p>
<div class="example">
<pre class="example">R> -2^2
[1] -4
</pre></div>
<p>and misunderstanding the precedence rules for expressions in R.
Write
</p>
<div class="example">
<pre class="example">R> (-2)^2
[1] 4
</pre></div>
<p>to get the square of <em>-2</em>.
</p>
<p>The precedence rules are documented in <code>?Syntax</code>, and to see how R
interprets an expression you can look at the parse tree
</p>
<div class="example">
<pre class="example">R> as.list(quote(-2^2))
[[1]]
`-`
[[2]]
2^2
</pre></div>
<hr>
<a name="How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f" accesskey="n" rel="next">Why are p-values not displayed when using lmer()?</a>, Previous: <a href="#Why-are-powers-of-negative-numbers-wrong_003f" accesskey="p" rel="prev">Why are powers of negative numbers wrong?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f-1"></a>
<h3 class="section">7.34 How can I save the result of each iteration in a loop into a separate file?</h3>
<p>One way is to use <code>paste()</code> (or <code>sprintf()</code>) to concatenate a
stem filename and the iteration number while <code>file.path()</code>
constructs the path. For example, to save results into files
<samp>result1.rda</samp>, …, <samp>result100.rda</samp> in the subdirectory
<samp>Results</samp> of the current working directory, one can use
</p>
<div class="example">
<pre class="example">for(i in 1:100) {
## Calculations constructing "some_object" ...
fp <- file.path("Results", paste("result", i, ".rda", sep = ""))
save(list = "some_object", file = fp)
}
</pre></div>
<hr>
<a name="Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-are-there-unwanted-borders" accesskey="n" rel="next">Why are there unwanted borders</a>, Previous: <a href="#How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f" accesskey="p" rel="prev">How can I save the result of each iteration in a loop into a separate file?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f-1"></a>
<h3 class="section">7.35 Why are <em>p</em>-values not displayed when using lmer()?</h3>
<p>Doug Bates has kindly provided an extensive response in a post to the
r-help list, which can be reviewed at
<a href="https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html">https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html</a>.
</p>
<hr>
<a name="Why-are-there-unwanted-borders"></a>
<div class="header">
<p>
Next: <a href="#Why-does-backslash-behave-strangely-inside-strings_003f" accesskey="n" rel="next">Why does backslash behave strangely inside strings?</a>, Previous: <a href="#Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f" accesskey="p" rel="prev">Why are p-values not displayed when using lmer()?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-are-there-unwanted-borders_002c-lines-or-grid_002dlike-artifacts-when-viewing-a-plot-saved-to-a-PS-or-PDF-file_003f"></a>
<h3 class="section">7.36 Why are there unwanted borders, lines or grid-like artifacts when viewing a plot saved to a PS or PDF file?</h3>
<p>This can occur when using functions such as <code>polygon()</code>,
<code>filled.contour()</code>, <code>image()</code> or other functions which may
call these internally. In the case of <code>polygon()</code>, you may observe
unwanted borders between the polygons even when setting the
<code>border</code> argument to <code>NA</code> or <code>"transparent"</code>.
</p>
<p>The source of the problem is the PS/PDF viewer when the plot is
anti-aliased. The details for the solution will be different depending
upon the viewer used, the operating system and may change over time.
For some common viewers, consider the following:
</p>
<dl compact="compact">
<dt>Acrobat Reader (cross platform)
<a name="index-Acrobat-Reader-_0028cross-platform_0029"></a>
</dt>
<dd><p>There are options in Preferences to enable/disable text smoothing, image
smoothing and line art smoothing.
Disable line art smoothing.
</p></dd>
<dt>Preview (macOS)
<a name="index-Preview-_0028macOS_0029"></a>
</dt>
<dd><p>There is an option in Preferences to enable/disable anti-aliasing of
text and line art.
Disable this option.
</p></dd>
<dt>GSview (cross platform)
<a name="index-GSview-_0028cross-platform_0029"></a>
</dt>
<dd><p>There are settings for Text Alpha and Graphics Alpha.
Change Graphics Alpha from 4 bits to 1 bit to disable graphic
anti-aliasing.
</p></dd>
<dt>gv (Unix-like X)
<a name="index-gv-_0028Unix_002dlike-X_0029"></a>
</dt>
<dd><p>There is an option to enable/disable anti-aliasing.
Disable this option.
</p></dd>
<dt>Evince (Linux/GNOME)
<a name="index-Evince-_0028Linux_002fGNOME_0029"></a>
</dt>
<dd><p>There is not an option to disable anti-aliasing in this viewer.
</p></dd>
<dt>Okular (Linux/KDE)
<a name="index-Okular-_0028Linux_002fKDE_0029"></a>
</dt>
<dd><p>There is not an option in the GUI to enable/disable anti-aliasing.
From a console command line, use:
</p><div class="smallexample">
<pre class="smallexample">$ kwriteconfig --file okularpartrc --group ‘Dlg Performance’ \
--key GraphicsAntialias Disabled
</pre></div>
<p>Then restart Okular. Change the final word to ‘<samp>Enabled</samp>’ to restore
the original setting.
</p></dd>
</dl>
<hr>
<a name="Why-does-backslash-behave-strangely-inside-strings_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f" accesskey="n" rel="next">How can I put error bars or confidence bands on my plot?</a>, Previous: <a href="#Why-are-there-unwanted-borders" accesskey="p" rel="prev">Why are there unwanted borders</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-backslash-behave-strangely-inside-strings_003f-1"></a>
<h3 class="section">7.37 Why does backslash behave strangely inside strings?</h3>
<p>This question most often comes up in relation to file names (see
<a href="#How-do-file-names-work-in-Windows_003f">How do file names work in Windows?</a>) but it also happens that
people complain that they cannot seem to put a single ‘<samp>\</samp>’ character
into a text string unless it happens to be followed by certain other
characters.
</p>
<p>To understand this, you have to distinguish between character strings
and <em>representations</em> of character strings. Mostly, the
representation in R is just the string with a single or double quote at
either end, but there are strings that cannot be represented that way,
e.g., strings that themselves contain the quote character. So
</p>
<div class="example">
<pre class="example">> str <- "This \"text\" is quoted"
> str
[1] "This \"text\" is quoted"
> cat(str, "\n")
This "text" is quoted
</pre></div>
<p>The <em>escape sequences</em> ‘<samp>\"</samp>’ and ‘<samp>\n</samp>’ represent a double
quote and the newline character respectively. Printing text strings,
using <code>print()</code> or by typing the name at the prompt will use the
escape sequences too, but the <code>cat()</code> function will display the
string as-is. Notice that ‘<samp>"\n"</samp>’ is a one-character string, not
two; the backslash is not actually in the string, it is just generated
in the printed representation.
</p>
<div class="example">
<pre class="example">> nchar("\n")
[1] 1
> substring("\n", 1, 1)
[1] "\n"
</pre></div>
<p>So how do you put a backslash in a string? For this, you have to
escape the escape character. I.e., you have to double the backslash.
as in
</p>
<div class="example">
<pre class="example">> cat("\\n", "\n")
\n
</pre></div>
<p>Some functions, particularly those involving regular expression
matching, themselves use metacharacters, which may need to be escaped by
the backslash mechanism. In those cases you may need a <em>quadruple</em>
backslash to represent a single literal one.
</p>
<p>In versions of R up to 2.4.1 an unknown escape sequence like ‘<samp>\p</samp>’
was quietly interpreted as just ‘<samp>p</samp>’. Current versions of R emit a
warning.
</p>
<hr>
<a name="How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f"></a>
<div class="header">
<p>
Next: <a href="#How-do-I-create-a-plot-with-two-y_002daxes_003f" accesskey="n" rel="next">How do I create a plot with two y-axes?</a>, Previous: <a href="#Why-does-backslash-behave-strangely-inside-strings_003f" accesskey="p" rel="prev">Why does backslash behave strangely inside strings?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f-1"></a>
<h3 class="section">7.38 How can I put error bars or confidence bands on my plot?</h3>
<p>Some functions will display a particular kind of plot with error bars,
such as the <code>bar.err()</code> function in the <a href="https://CRAN.R-project.org/package=agricolae"><strong>agricolae</strong></a>
package, the <code>plotCI()</code> function in the <a href="https://CRAN.R-project.org/package=gplots"><strong>gplots</strong></a> package,
the <code>plotCI()</code> and <code>brkdn.plot()</code> functions in the
<a href="https://CRAN.R-project.org/package=plotrix"><strong>plotrix</strong></a> package and the <code>error.bars()</code>,
<code>error.crosses()</code> and <code>error.bars.by()</code> functions in the
<a href="https://CRAN.R-project.org/package=psych"><strong>psych</strong></a> package. Within these types of functions, some will
accept the measures of dispersion (e.g., <code>plotCI</code>), some will
calculate the dispersion measures from the raw values (<code>bar.err</code>,
<code>brkdn.plot</code>), and some will do both (<code>error.bars</code>). Still
other functions will just display error bars, like the dispersion
function in the <a href="https://CRAN.R-project.org/package=plotrix"><strong>plotrix</strong></a> package. Most of the above functions
use the <code>arrows()</code> function in the base <strong>graphics</strong> package to
draw the error bars.
</p>
<p>The above functions all use the base graphics system. The grid and
lattice graphics systems also have specific functions for displaying
error bars, e.g., the <code>grid.arrow()</code> function in the <strong>grid</strong>
package, and the <code>geom_errorbar()</code>, <code>geom_errorbarh()</code>,
<code>geom_pointrange()</code>, <code>geom_linerange()</code>,
<code>geom_crossbar()</code> and <code>geom_ribbon()</code> functions in the
<a href="https://CRAN.R-project.org/package=ggplot2"><strong>ggplot2</strong></a> package. In the lattice system, error bars can be
displayed with <code>Dotplot()</code> or <code>xYplot()</code> in the
<a href="https://CRAN.R-project.org/package=Hmisc"><strong>Hmisc</strong></a> package and <code>segplot()</code> in the
<a href="https://CRAN.R-project.org/package=latticeExtra"><strong>latticeExtra</strong></a> package.
</p>
<hr>
<a name="How-do-I-create-a-plot-with-two-y_002daxes_003f"></a>
<div class="header">
<p>
Next: <a href="#How-do-I-access-the-source-code-for-a-function_003f" accesskey="n" rel="next">How do I access the source code for a function?</a>, Previous: <a href="#How-can-I-put-error-bars-or-confidence-bands-on-my-plot_003f" accesskey="p" rel="prev">How can I put error bars or confidence bands on my plot?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-do-I-create-a-plot-with-two-y_002daxes_003f-1"></a>
<h3 class="section">7.39 How do I create a plot with two y-axes?</h3>
<p>Creating a graph with two y-axes, i.e., with two sorts of data that are
scaled to the same vertical size and showing separate vertical axes on
the left and right sides of the plot that reflect the original scales of
the data, is possible in R but is not recommended. The basic approach
for constructing such graphs is to use <code>par(new=TRUE)</code> (see
<code>?par</code>); functions <code>twoord.plot()</code> (in the <a href="https://CRAN.R-project.org/package=plotrix"><strong>plotrix</strong></a>
package) and <code>doubleYScale()</code> (in the <a href="https://CRAN.R-project.org/package=latticeExtra"><strong>latticeExtra</strong></a>
package) automate the process somewhat.
</p>
<hr>
<a name="How-do-I-access-the-source-code-for-a-function_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f" accesskey="n" rel="next">Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?</a>, Previous: <a href="#How-do-I-create-a-plot-with-two-y_002daxes_003f" accesskey="p" rel="prev">How do I create a plot with two y-axes?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-do-I-access-the-source-code-for-a-function_003f-1"></a>
<h3 class="section">7.40 How do I access the source code for a function?</h3>
<p>In most cases, typing the name of the function will print its source
code. However, code is sometimes hidden in a namespace, or compiled. For
a complete overview on how to access source code, see Uwe Ligges (2006),
“Help Desk: Accessing the sources”, <em>R News</em>, <strong>6/4</strong>,
43–45 (<a href="https://CRAN.R-project.org/doc/Rnews/Rnews_2006-4.pdf">https://CRAN.R-project.org/doc/Rnews/Rnews_2006-4.pdf</a>).
</p>
<hr>
<a name="Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f"></a>
<div class="header">
<p>
Next: <a href="#Why-is-R-apparently-not-releasing-memory_003f" accesskey="n" rel="next">Why is R apparently not releasing memory?</a>, Previous: <a href="#How-do-I-access-the-source-code-for-a-function_003f" accesskey="p" rel="prev">How do I access the source code for a function?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f-1"></a>
<h3 class="section">7.41 Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?</h3>
<p>As described in <code>?summary.lm</code>, when the intercept is zero (e.g.,
from <code>y ~ x - 1</code> or <code>y ~ x + 0</code>), <code>summary.lm()</code> uses the
formula
R^2 = 1 - Sum(R[i]^2) / Sum((y[i])^2)
which is different from the usual
R^2 = 1 - Sum(R[i]^2) / Sum((y[i] - mean(y))^2).
There are several reasons for this:
</p><ul>
<li> Otherwise the <em>R^2</em> could be negative (because the model with zero
intercept can fit <em>worse</em> than the constant-mean model it is
implicitly compared to).
</li><li> If you set the slope to zero in the model with a line through the
origin you get fitted values y*=0
</li><li> The model with constant, non-zero mean is not nested in the model
with a line through the origin.
</li></ul>
<p>All these come down to saying that if you know <em>a priori</em> that
<em>E[Y]=0</em> when <em>x=0</em> then the ‘null’ model that you should
compare to the fitted line, the model where <em>x</em> doesn’t explain any
of the variance, is the model where <em>E[Y]=0</em> everywhere. (If you
don’t know a priori that <em>E[Y]=0</em> when <em>x=0</em>, then you
probably shouldn’t be fitting a line through the origin.)
</p>
<hr>
<a name="Why-is-R-apparently-not-releasing-memory_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-enable-secure-https-downloads-in-R_003f" accesskey="n" rel="next">How can I enable secure https downloads in R?</a>, Previous: <a href="#Why-does-summary_0028_0029-report-strange-results-for-the-R_005e2-estimate-when-I-fit-a-linear-model-with-no-intercept_003f" accesskey="p" rel="prev">Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Why-is-R-apparently-not-releasing-memory_003f-1"></a>
<h3 class="section">7.42 Why is R apparently not releasing memory?</h3>
<p>This question is often asked in different flavors along the lines of
“I have removed objects in R and run <code>gc()</code> and yet
<code>ps</code>/<code>top</code> still shows the R process using a lot of
memory”, often on Linux machines.
</p>
<p>This is an artifact of the way the operating system (OS) allocates
memory. In general it is common that the OS is not capable of
releasing all unused memory. In extreme cases it is possible that even
if R frees almost all its memory, the OS can not release any of it due
to its design and thus tools such as <code>ps</code> or <code>top</code> will
report substantial amount of resident RAM used by the R process even
though R has released all that memory. In general such tools do
<em>not</em> report the actual memory usage of the process but rather
what the OS is reserving for that process.
</p>
<p>The short answer is that this is a limitation of the memory allocator
in the operating system and there is nothing R can do about it. That
space is simply kept by the OS in the hope that R will ask for it
later. The following paragraph gives more in-depth answer with
technical details on how this happens.
</p>
<p>Most systems use two separate ways to allocate memory. For allocation
of large chunks they will use <code>mmap</code> to map memory into the
process address space. Such chunks can be released immediately when
they are completely free, because they can reside anywhere in the
virtual memory. However, this is a relatively expensive operation and
many OSes have a limit on the number of such allocated chunks, so this
is only used for allocating large memory regions. For smaller
allocations the system can expand the data segment of the process
(historically using the <code>brk</code> system call), but this whole area
is always contiguous. The OS can only move the end of this space, it
cannot create any “holes”. Since this operation is fairly cheap, it
is used for allocations of small pieces of memory. However, the
side-effect is that even if there is just one byte that is in use
at the end of the data segment, the OS cannot release any memory
at all, because it cannot change the address of that byte. This is
actually more common than it may seem, because allocating a lot of
intermediate objects, then allocating a result object and removing all
intermediate objects is a very common practice. Since the result is
allocated at the end it will prevent the OS from releasing any memory
used by the intermediate objects. In practice, this is not necessarily
a problem, because modern operating systems can page out unused
portions of the virtual memory so it does not necessarily reduce the
amount of real memory available for other applications. Typically,
small objects such as strings or pairlists will be affected by this
behavior, whereas large objects such as long vectors will be allocated
using <code>mmap</code> and thus not affected. On Linux (and possibly other
Unix-like systems) it is possible to use the <code>mallinfo</code> system call
(also see the <a href="https://rforge.net/mallinfo">mallinfo</a> package) to
query the allocator about the layout of the allocations, including the
actually used memory as well as unused memory that cannot be released.
</p>
<hr>
<a name="How-can-I-enable-secure-https-downloads-in-R_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f" accesskey="n" rel="next">How can I get CRAN package binaries for outdated versions of R?</a>, Previous: <a href="#Why-is-R-apparently-not-releasing-memory_003f" accesskey="p" rel="prev">Why is R apparently not releasing memory?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-enable-secure-https-downloads-in-R_003f-1"></a>
<h3 class="section">7.43 How can I enable secure https downloads in R?</h3>
<p>When R transfers files over <acronym>HTTP</acronym> (e.g., using the
<code>install.packages()</code> or <code>download.file()</code> function), a
download method is chosen based on the <samp>download.file.method</samp>
option. There are several methods available and the default behavior if
no option is explicitly specified is to use R’s internal <acronym>HTTP</acronym>
implementation. In most circumstances this internal method will not
support <acronym>HTTPS</acronym> URLs so you will need to override the default:
this is done automatically for such URLs as from R 3.2.2.
</p>
<p>R versions 3.2.0 and greater include two download methods
(<code>"libcurl"</code> and <code>"wininet"</code>) that both support
<acronym>HTTPS</acronym> connections: we recommend that you use these methods.
The requisite code to add to <samp>.Rprofile</samp> or <samp>Rprofile.site</samp> is:
</p>
<div class="example">
<pre class="example">options(download.file.method = "wininet", url.method = "wininet")
<span class="roman">(Windows)</span>
options(download.file.method = "libcurl", url.method = "libcurl")
<span class="roman">(Linux and macOS)</span>
</pre></div>
<p>(Method <code>"wininet"</code> is the default on Windows as from R 3.2.2.)
</p>
<p>Note that the <code>"libcurl"</code> method may or may not have been compiled
in. In the case that it was not, i.e.. <code>capabilities("libcurl") ==
FALSE</code>, we recommend method <code>"wget"</code> on Linux and <code>"curl"</code> on
macOS. It is possible that system versions of <code>"libcurl"</code>,
<code>wget</code> or <code>curl</code> may have been compiled without
<acronym>HTTPS</acronym> support, but this is unlikely. As from R 3.3.0
<code>"libcurl"</code> with <acronym>HTTPS</acronym> support is required except on
Windows.
</p>
<hr>
<a name="How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f"></a>
<div class="header">
<p>
Previous: <a href="#How-can-I-enable-secure-https-downloads-in-R_003f" accesskey="p" rel="prev">How can I enable secure https downloads in R?</a>, Up: <a href="#R-Miscellanea" accesskey="u" rel="up">R Miscellanea</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-get-CRAN-package-binaries-for-outdated-versions-of-R_003f-1"></a>
<h3 class="section">7.44 How can I get CRAN package binaries for outdated versions of R?</h3>
<p>Since March 2016, Windows and macOS binaries of <acronym>CRAN</acronym> packages for old
versions of R (released more than 5 years ago) are made available from a
central <acronym>CRAN</acronym> archive server instead of the <acronym>CRAN</acronym> mirrors. To get
these, one should set the <acronym>CRAN</acronym> “mirror” element of the <code>repos</code>
option accordingly, by something like
</p><div class="example">
<pre class="example">local({r <- getOption("repos")
r["CRAN"] <- "http://CRAN-archive.R-project.org"
options(repos = r)
})
</pre></div>
<p>(see <code>?options</code> for more information).
</p>
<hr>
<a name="R-Programming"></a>
<div class="header">
<p>
Next: <a href="#R-Bugs" accesskey="n" rel="next">R Bugs</a>, Previous: <a href="#R-Miscellanea" accesskey="p" rel="prev">R Miscellanea</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Programming-1"></a>
<h2 class="chapter">8 R Programming</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#How-should-I-write-summary-methods_003f" accesskey="1">How should I write summary methods?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-debug-dynamically-loaded-code_003f" accesskey="2">How can I debug dynamically loaded code?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-inspect-R-objects-when-debugging_003f" accesskey="3">How can I inspect R objects when debugging?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-change-compilation-flags_003f" accesskey="4">How can I change compilation flags?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-can-I-debug-S4-methods_003f" accesskey="5">How can I debug S4 methods?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="How-should-I-write-summary-methods_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-debug-dynamically-loaded-code_003f" accesskey="n" rel="next">How can I debug dynamically loaded code?</a>, Previous: <a href="#R-Programming" accesskey="p" rel="prev">R Programming</a>, Up: <a href="#R-Programming" accesskey="u" rel="up">R Programming</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-should-I-write-summary-methods_003f-1"></a>
<h3 class="section">8.1 How should I write summary methods?</h3>
<p>Suppose you want to provide a summary method for class <code>"foo"</code>.
Then <code>summary.foo()</code> should not print anything, but return an
object of class <code>"summary.foo"</code>, <em>and</em> you should write a
method <code>print.summary.foo()</code> which nicely prints the summary
information and invisibly returns its object. This approach is
preferred over having <code>summary.foo()</code> print summary information and
return something useful, as sometimes you need to grab something
computed by <code>summary()</code> inside a function or similar. In such
cases you don’t want anything printed.
</p>
<hr>
<a name="How-can-I-debug-dynamically-loaded-code_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-inspect-R-objects-when-debugging_003f" accesskey="n" rel="next">How can I inspect R objects when debugging?</a>, Previous: <a href="#How-should-I-write-summary-methods_003f" accesskey="p" rel="prev">How should I write summary methods?</a>, Up: <a href="#R-Programming" accesskey="u" rel="up">R Programming</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-debug-dynamically-loaded-code_003f-1"></a>
<h3 class="section">8.2 How can I debug dynamically loaded code?</h3>
<p>Roughly speaking, you need to start R inside the debugger, load the
code, send an interrupt, and then set the required breakpoints.
</p>
<p>See <a href="http://cran.r-project.org/doc/manuals/R-exts.html#Finding-entry-points">Finding entry points in dynamically loaded
code</a> in <cite>Writing R Extensions</cite>.
</p>
<hr>
<a name="How-can-I-inspect-R-objects-when-debugging_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-change-compilation-flags_003f" accesskey="n" rel="next">How can I change compilation flags?</a>, Previous: <a href="#How-can-I-debug-dynamically-loaded-code_003f" accesskey="p" rel="prev">How can I debug dynamically loaded code?</a>, Up: <a href="#R-Programming" accesskey="u" rel="up">R Programming</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-inspect-R-objects-when-debugging_003f-1"></a>
<h3 class="section">8.3 How can I inspect R objects when debugging?</h3>
<p>The most convenient way is to call <code>R_PV</code> from the symbolic
debugger.
</p>
<p>See <a href="http://cran.r-project.org/doc/manuals/R-exts.html#Inspecting-R-objects">Inspecting R objects when debugging</a> in <cite>Writing R Extensions</cite>.
</p>
<hr>
<a name="How-can-I-change-compilation-flags_003f"></a>
<div class="header">
<p>
Next: <a href="#How-can-I-debug-S4-methods_003f" accesskey="n" rel="next">How can I debug S4 methods?</a>, Previous: <a href="#How-can-I-inspect-R-objects-when-debugging_003f" accesskey="p" rel="prev">How can I inspect R objects when debugging?</a>, Up: <a href="#R-Programming" accesskey="u" rel="up">R Programming</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-change-compilation-flags_003f-1"></a>
<h3 class="section">8.4 How can I change compilation flags?</h3>
<p>Suppose you have C code file for dynloading into R, but you want to use
<code>R CMD SHLIB</code> with compilation flags other than the default ones
(which were determined when R was built).
</p>
<p>Starting with R 2.1.0, users can provide personal Makevars configuration
files in <samp>$<code>HOME</code>/.R</samp> to override the default flags.
See <a href="http://cran.r-project.org/doc/manuals/R-admin.html#Add_002don-packages">Add-on packages</a> in <cite>R Installation and Administration</cite>.
</p>
<p>For earlier versions of R, you could change the file
<samp><var>R_HOME</var>/etc/Makeconf</samp> to reflect your preferences, or (at
least for systems using <acronym>GNU</acronym> Make) override them by the
environment variable <code>MAKEFLAGS</code>.
See <a href="http://cran.r-project.org/doc/manuals/R-exts.html#Creating-shared-objects">Creating shared objects</a> in <cite>Writing R Extensions</cite>.
</p>
<hr>
<a name="How-can-I-debug-S4-methods_003f"></a>
<div class="header">
<p>
Previous: <a href="#How-can-I-change-compilation-flags_003f" accesskey="p" rel="prev">How can I change compilation flags?</a>, Up: <a href="#R-Programming" accesskey="u" rel="up">R Programming</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-can-I-debug-S4-methods_003f-1"></a>
<h3 class="section">8.5 How can I debug S4 methods?</h3>
<p>Use the <code>trace()</code> function with argument <code>signature=</code> to add
calls to the browser or any other code to the method that will be
dispatched for the corresponding signature. See <code>?trace</code> for
details.
</p>
<hr>
<a name="R-Bugs"></a>
<div class="header">
<p>
Next: <a href="#Acknowledgments" accesskey="n" rel="next">Acknowledgments</a>, Previous: <a href="#R-Programming" accesskey="p" rel="prev">R Programming</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="R-Bugs-1"></a>
<h2 class="chapter">9 R Bugs</h2>
<table summary="" class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#What-is-a-bug_003f" accesskey="1">What is a bug?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#How-to-report-a-bug" accesskey="2">How to report a bug</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="What-is-a-bug_003f"></a>
<div class="header">
<p>
Next: <a href="#How-to-report-a-bug" accesskey="n" rel="next">How to report a bug</a>, Previous: <a href="#R-Bugs" accesskey="p" rel="prev">R Bugs</a>, Up: <a href="#R-Bugs" accesskey="u" rel="up">R Bugs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="What-is-a-bug_003f-1"></a>
<h3 class="section">9.1 What is a bug?</h3>
<p>If R executes an illegal instruction, or dies with an operating system
error message that indicates a problem in the program (as opposed to
something like “disk full”), then it is certainly a bug. If you call
<code>.C()</code>, <code>.Fortran()</code>, <code>.External()</code> or <code>.Call()</code> (or
<code>.Internal()</code>) yourself (or in a function you wrote), you can
always crash R by using wrong argument types (modes). This is not a
bug.
</p>
<p>Taking forever to complete a command can be a bug, but you must make
certain that it was really R’s fault. Some commands simply take a long
time. If the input was such that you <em>know</em> it should have been
processed quickly, report a bug. If you don’t know whether the command
should take a long time, find out by looking in the manual or by asking
for assistance.
</p>
<p>If a command you are familiar with causes an R error message in a case
where its usual definition ought to be reasonable, it is probably a bug.
If a command does the wrong thing, that is a bug. But be sure you know
for certain what it ought to have done. If you aren’t familiar with the
command, or don’t know for certain how the command is supposed to work,
then it might actually be working right. For example, people sometimes
think there is a bug in R’s mathematics because they don’t understand
how finite-precision arithmetic works. Rather than jumping to
conclusions, show the problem to someone who knows for certain.
Unexpected results of comparison of decimal numbers, for example
<code>0.28 * 100 != 28</code> or <code>0.1 + 0.2 != 0.3</code>, are not a bug.
See <a href="#Why-doesn_0027t-R-think-these-numbers-are-equal_003f">Why doesn't R think these numbers are equal?</a>, for more details.
</p>
<p>Finally, a command’s intended definition may not be best for statistical
analysis. This is a very important sort of problem, but it is also a
matter of judgment. Also, it is easy to come to such a conclusion out
of ignorance of some of the existing features. It is probably best not
to complain about such a problem until you have checked the
documentation in the usual ways, feel confident that you understand it,
and know for certain that what you want is not available. If you are
not sure what the command is supposed to do after a careful reading of
the manual this indicates a bug in the manual. The manual’s job is to
make everything clear. It is just as important to report documentation
bugs as program bugs. However, we know that the introductory
documentation is seriously inadequate, so you don’t need to report this.
</p>
<p>If the online argument list of a function disagrees with the manual, one
of them must be wrong, so report the bug.
</p>
<hr>
<a name="How-to-report-a-bug"></a>
<div class="header">
<p>
Previous: <a href="#What-is-a-bug_003f" accesskey="p" rel="prev">What is a bug?</a>, Up: <a href="#R-Bugs" accesskey="u" rel="up">R Bugs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="How-to-report-a-bug-1"></a>
<h3 class="section">9.2 How to report a bug</h3>
<p>When you decide that there is a bug, it is important to report it and to
report it in a way which is useful. What is most useful is an exact
description of what commands you type, starting with the shell command
to run R, until the problem happens. Always include the version of R,
machine, and operating system that you are using; type <kbd>version</kbd> in
R to print this.
</p>
<p>The most important principle in reporting a bug is to report
<em>facts</em>, not hypotheses or categorizations. It is always easier to
report the facts, but people seem to prefer to strain to posit
explanations and report them instead. If the explanations are based on
guesses about how R is implemented, they will be useless; others will
have to try to figure out what the facts must have been to lead to such
speculations. Sometimes this is impossible. But in any case, it is
unnecessary work for the ones trying to fix the problem.
</p>
<p>For example, suppose that on a data set which you know to be quite large
the command
</p>
<div class="example">
<pre class="example">R> data.frame(x, y, z, monday, tuesday)
</pre></div>
<p>never returns. Do not report that <code>data.frame()</code> fails for large
data sets. Perhaps it fails when a variable name is a day of the week.
If this is so then when others got your report they would try out the
<code>data.frame()</code> command on a large data set, probably with no day of
the week variable name, and not see any problem. There is no way in the
world that others could guess that they should try a day of the week
variable name.
</p>
<p>Or perhaps the command fails because the last command you used was a
method for <code>"["()</code> that had a bug causing R’s internal data
structures to be corrupted and making the <code>data.frame()</code> command
fail from then on. This is why others need to know what other commands
you have typed (or read from your startup file).
</p>
<p>It is very useful to try and find simple examples that produce
apparently the same bug, and somewhat useful to find simple examples
that might be expected to produce the bug but actually do not. If you
want to debug the problem and find exactly what caused it, that is
wonderful. You should still report the facts as well as any
explanations or solutions. Please include an example that reproduces
(e.g., <a href="https://en.wikipedia.org/wiki/Reproducibility">https://en.wikipedia.org/wiki/Reproducibility</a>) the problem,
preferably the simplest one you have found.
</p>
<p>Invoking R with the <samp>--vanilla</samp> option may help in isolating a
bug. This ensures that the site profile and saved data files are not
read.
</p>
<p>Before you actually submit a bug report, you should check whether the
bug has already been reported and/or fixed. First, try the “Show open
bugs new-to-old” or the search facility on
<a href="https://bugs.R-project.org/">https://bugs.R-project.org/</a>. Second, consult
<a href="https://svn.R-project.org/R/trunk/doc/NEWS.Rd">https://svn.R-project.org/R/trunk/doc/NEWS.Rd</a>, which
records changes that will appear in the <em>next</em> release of R,
including bug fixes that do not appear on the Bug Tracker.
Third, if possible try the current r-patched or r-devel version of R.
If a bug has already been reported or fixed, please do not submit
further bug reports on it. Finally, check carefully whether the bug is
with R, or a contributed package. Bug reports on contributed packages
should be sent first to the package maintainer, and only submitted to
the R-bugs repository by package maintainers, mentioning the package in
the subject line.
</p>
<p>A bug report can be generated using the function <code>bug.report()</code>.
For reports on R this will open the Web page at
<a href="https://bugs.R-project.org/">https://bugs.R-project.org/</a>: for a contributed package it will open
the package’s bug tracker Web page or help you compose an email to the
maintainer.
</p>
<p>There is a section of the bug repository for suggestions for
enhancements for R labelled ‘<samp>wishlist</samp>’. Suggestions can be
submitted in the same ways as bugs, but please ensure that the subject
line makes clear that this is for the wishlist and not a bug report, for
example by starting with ‘<samp>Wishlist:</samp>’.
</p>
<p>Comments on and suggestions for the Windows port of R should be sent to
<a href="mailto:R-windows@R-project.org">R-windows@R-project.org</a>.
</p>
<p>Corrections to and comments on message translations should be sent to the
last translator (listed at the top of the appropriate ‘<samp>.po</samp>’ file)
or to the translation team as listed at
<a href="https://developer.R-project.org/TranslationTeams.html">https://developer.R-project.org/TranslationTeams.html</a>.
</p>
<hr>
<a name="Acknowledgments"></a>
<div class="header">
<p>
Previous: <a href="#R-Bugs" accesskey="p" rel="prev">R Bugs</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<a name="Acknowledgments-1"></a>
<h2 class="chapter">10 Acknowledgments</h2>
<p>Of course, many many thanks to Robert and Ross for the R system, and to
the package writers and porters for adding to it.
</p>
<p>Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian
D. Ripley, Anthony Rossini, and Andreas Weingessel for their comments
which helped me improve this <acronym>FAQ</acronym>.
</p>
<p>More to come soon …
</p>
<hr>
</body>
</html>
|