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 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649
|
R FAQ
Frequently Asked Questions on R
Version 2.4.2006-11-23
ISBN 3-900051-08-9
Kurt Hornik
Table of Contents
*****************
R FAQ
1 Introduction
1.1 Legalese
1.2 Obtaining this document
1.3 Citing this document
1.4 Notation
1.5 Feedback
2 R Basics
2.1 What is R?
2.2 What machines does R run on?
2.3 What is the current version of R?
2.4 How can R be obtained?
2.5 How can R be installed?
2.5.1 How can R be installed (Unix)
2.5.2 How can R be installed (Windows)
2.5.3 How can R be installed (Macintosh)
2.6 Are there Unix binaries for R?
2.7 What documentation exists for R?
2.8 Citing R
2.9 What mailing lists exist for R?
2.10 What is CRAN?
2.11 Can I use R for commercial purposes?
2.12 Why is R named R?
2.13 What is the R Foundation?
3 R and S
3.1 What is S?
3.2 What is S-PLUS?
3.3 What are the differences between R and S?
3.3.1 Lexical scoping
3.3.2 Models
3.3.3 Others
3.4 Is there anything R can do that S-PLUS cannot?
3.5 What is R-plus?
4 R Web Interfaces
5 R Add-On Packages
5.1 Which add-on packages exist for R?
5.1.1 Add-on packages in R
5.1.2 Add-on packages from CRAN
5.1.3 Add-on packages from Omegahat
5.1.4 Add-on packages from Bioconductor
5.1.5 Other add-on packages
5.2 How can add-on packages be installed?
5.3 How can add-on packages be used?
5.4 How can add-on packages be removed?
5.5 How can I create an R package?
5.6 How can I contribute to R?
6 R and Emacs
6.1 Is there Emacs support for R?
6.2 Should I run R from within Emacs?
6.3 Debugging R from within Emacs
7 R Miscellanea
7.1 How can I set components of a list to NULL?
7.2 How can I save my workspace?
7.3 How can I clean up my workspace?
7.4 How can I get eval() and D() to work?
7.5 Why do my matrices lose dimensions?
7.6 How does autoloading work?
7.7 How should I set options?
7.8 How do file names work in Windows?
7.9 Why does plotting give a color allocation error?
7.10 How do I convert factors to numeric?
7.11 Are Trellis displays implemented in R?
7.12 What are the enclosing and parent environments?
7.13 How can I substitute into a plot label?
7.14 What are valid names?
7.15 Are GAMs implemented in R?
7.16 Why is the output not printed when I source() a file?
7.17 Why does outer() behave strangely with my function?
7.18 Why does the output from anova() depend on the order of factors in the model?
7.19 How do I produce PNG graphics in batch mode?
7.20 How can I get command line editing to work?
7.21 How can I turn a string into a variable?
7.22 Why do lattice/trellis graphics not work?
7.23 How can I sort the rows of a data frame?
7.24 Why does the help.start() search engine not work?
7.25 Why did my .Rprofile stop working when I updated R?
7.26 Where have all the methods gone?
7.27 How can I create rotated axis labels?
7.28 Why is read.table() so inefficient?
7.29 What is the difference between package and library?
7.30 I installed a package but the functions are not there
7.31 Why doesn't R think these numbers are equal?
7.32 How can I capture or ignore errors in a long simulation?
7.33 Why are powers of negative numbers wrong?
7.34 How can I save the result of each iteration in a loop into a separate file?
7.35 Why are p-values not displayed when using lmer()?
7.36 Why are there unwanted lines between polygons in PDF output viewed in Adobe Reader?
7.37 Why does backslash behave strangely inside strings?
8 R Programming
8.1 How should I write summary methods?
8.2 How can I debug dynamically loaded code?
8.3 How can I inspect R objects when debugging?
8.4 How can I change compilation flags?
8.5 How can I debug S4 methods?
9 R Bugs
9.1 What is a bug?
9.2 How to report a bug
10 Acknowledgments
R FAQ
*****
1 Introduction
**************
This document contains answers to some of the most frequently asked
questions about R.
1.1 Legalese
============
This document is copyright (C) 1998-2006 by Kurt Hornik.
This document is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
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 GNU General Public License
for more details.
A copy of the GNU General Public License is available via WWW at
`http://www.gnu.org/copyleft/gpl.html'.
You can also obtain it by writing to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301, U.S.A.
1.2 Obtaining this document
===========================
The latest version of this document is always available from
`http://CRAN.R-project.org/doc/FAQ/'
From there, you can obtain versions converted to plain ASCII text, DVI,
GNU info, HTML, PDF, PostScript as well as the Texinfo source used for
creating all these formats using the GNU Texinfo system
(http://texinfo.org/).
You can also obtain the R FAQ from the `doc/FAQ' subdirectory of a CRAN
site (*note What is CRAN?::).
1.3 Citing this document
========================
In publications, please refer to this FAQ as Hornik (2006), "The R FAQ",
and give the above, _official_ URL and the ISBN 3-900051-08-9:
@Misc{,
author = {Kurt Hornik},
title = {The {R} {FAQ}},
year = {2006},
note = {{ISBN} 3-900051-08-9},
url = {http://CRAN.R-project.org/doc/FAQ/R-FAQ.html}
}
1.4 Notation
============
Everything should be pretty standard. `R>' is used for the R prompt, and a
`$' for the shell prompt (where applicable).
1.5 Feedback
============
Feedback via email to <Kurt.Hornik@R-project.org> is of course most welcome.
In particular, note that I do not have access to Windows or Macintosh
systems. Features specific to the Windows and Mac OS X ports of R are
described in the "R for Windows FAQ"
(http://cran.R-project.org/bin/windows/base/rw-FAQ.html) and the "R for Mac
OS X FAQ (http://cran.R-project.org/bin/macosx/RMacOSX-FAQ.html). If you
have information on Macintosh or Windows systems that you think should be
added to this document, please let me know.
2 R Basics
**********
2.1 What is R?
==============
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.
The design of R has been heavily influenced by two existing languages:
Becker, Chambers & Wilks' S (*note What is S?::) and Sussman's Scheme
(http://www.cs.indiana.edu/scheme-repository/home.html). Whereas the
resulting language is very similar in appearance to S, the underlying
implementation and semantics are derived from Scheme. *Note What are the
differences between R and S?::, for further details.
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 (*note R Add-On Packages::).
R was initially written by Ross Ihaka <Ross.Ihaka@R-project.org> and
Robert Gentleman <Robert.Gentleman@R-project.org> 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.
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,
Stefano Iacus, Ross Ihaka, Friedrich Leisch, Thomas Lumley, Martin
Maechler, Duncan Murdoch, Paul Murrell, Martyn Plummer, Brian Ripley,
Duncan Temple Lang, Luke Tierney, and Simon Urbanek.
R has a home page at `http://www.R-project.org/'. It is free software
(http://www.gnu.org/philosophy/free-sw.html) distributed under a GNU-style
copyleft (http://www.gnu.org/copyleft/copyleft.html), and an official part
of the GNU (http://www.gnu.org/) project ("GNU S").
2.2 What machines does R run on?
================================
R is being developed for the Unix, Windows and Mac families of operating
systems. Support for Mac OS Classic ended with R 1.7.1.
The current version of R will configure and build under a number of
common Unix platforms including CPU-linux-gnu for the i386, alpha, arm,
hppa, ia64, m68k, mips/mipsel, powerpc, s390, sparc (e.g.,
`http://buildd.debian.org/build.php?&pkg=r-base'), and x86_64 CPUs,
powerpc-apple-darwin, mips-sgi-irix, rs6000-ibm-aix, and sparc-sun-solaris.
If you know about other platforms, please drop us a note.
2.3 What is the current version of R?
=====================================
The current released version is 2.4.0. Based on this
`major.minor.patchlevel' numbering scheme, there are 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. Version r-patched is for bug fixes mostly. New
features are typically introduced in r-devel.
2.4 How can R be obtained?
==========================
Sources, binaries and documentation for R can be obtained via CRAN, the
"Comprehensive R Archive Network" (see *Note What is CRAN?::).
Sources are also available via `https://svn.R-project.org/R/', the R
Subversion repository, but currently not via anonymous rsync (nor CVS).
Tarballs with daily snapshots of the r-devel and r-patched development
versions of R can be found at `ftp://ftp.stat.math.ethz.ch/Software/R'.
2.5 How can R be installed?
===========================
2.5.1 How can R be installed (Unix)
-----------------------------------
If R is already installed, it can be started by typing `R' at the shell
prompt (of course, provided that the executable is in your path).
If binaries are available for your platform (see *Note Are there Unix
binaries for R?::), you can use these, following the instructions that come
with them.
Otherwise, you can compile and install R yourself, which can be done
very easily under a number of common Unix platforms (see *Note What
machines does R run on?::). The file `INSTALL' that comes with the R
distribution contains a brief introduction, and the "R Installation and
Administration" guide (*note What documentation exists for R?::) has full
details.
Note that you need a FORTRAN compiler or perhaps `f2c' in addition to a
C compiler to build R. Also, you need Perl version 5 to build the R object
documentations. (If this is not available on your system, you can obtain a
PDF version of the object reference manual via CRAN.)
In the simplest case, untar the R source code, change to the directory
thus created, and issue the following commands (at the shell prompt):
$ ./configure
$ make
If these commands execute successfully, the R binary and a shell script
front-end called `R' are created and copied to the `bin' directory. You
can copy the script to a place where users can invoke it, for example to
`/usr/local/bin'. In addition, plain text help pages as well as HTML and
LaTeX versions of the documentation are built.
Use `make dvi' to create DVI versions of the R manuals, such as
`refman.dvi' (an R object reference index) and `R-exts.dvi', the "R
Extension Writers Guide", in the `doc/manual' subdirectory. These files
can be previewed and printed using standard programs such as `xdvi' and
`dvips'. You can also use `make pdf' to build PDF (Portable Document
Format) version of the manuals, and view these using e.g. Acrobat. Manuals
written in the GNU Texinfo system can also be converted to info files
suitable for reading online with Emacs or stand-alone GNU Info; use `make
info' to create these versions (note that this requires Makeinfo version
4.5).
Finally, use `make check' to find out whether your R system works
correctly.
You can also perform a "system-wide" installation using `make install'.
By default, this will install to the following directories:
`${prefix}/bin'
the front-end shell script
`${prefix}/man/man1'
the man page
`${prefix}/lib/R'
all the rest (libraries, on-line help system, ...). This is the "R
Home Directory" (`R_HOME') of the installed system.
In the above, `prefix' is determined during configuration (typically
`/usr/local') and can be set by running `configure' with the option
$ ./configure --prefix=/where/you/want/R/to/go
(E.g., the R executable will then be installed into
`/where/you/want/R/to/go/bin'.)
To install DVI, info and PDF versions of the manuals, use `make
install-dvi', `make install-info' and `make install-pdf', respectively.
2.5.2 How can R be installed (Windows)
--------------------------------------
The `bin/windows' directory of a CRAN site contains binaries for a base
distribution and a large number of add-on packages from CRAN to run on
Windows 95, 98, ME, NT4, 2000, and XP (at least) on Intel and clones (but
not on other platforms). The Windows version of R was created by Robert
Gentleman and Guido Masarotto, and is now being developed and maintained by
Duncan Murdoch <murdoch@stats.uwo.ca> and Brian D. Ripley
<Brian.Ripley@R-project.org>.
For most installations the Windows installer program will be the easiest
tool to use.
See the "R for Windows FAQ"
(http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) for more details.
2.5.3 How can R be installed (Macintosh)
----------------------------------------
The `bin/macosx' directory of a CRAN site contains a standard Apple
installer package inside a disk image named `R.dmg'. Once downloaded and
executed, the installer will install the current non-developer release of
R. RAqua is a native Mac OS X Darwin version of R with a R.app Mac OS X
GUI. Inside `bin/macosx/powerpc/contrib/X.Y' there are prebuilt binary
packages (for powerpc version of Mac OS X) to be used with RAqua
corresponding to the "X.Y" release of R. The installation of these packages
is available through the "Package" menu of the R.app GUI. This port of R
for Mac OS X is maintained by Stefano Iacus <Stefano.Iacus@R-project.org>.
The "R for Mac OS X FAQ
(http://cran.R-project.org/bin/macosx/RMacOSX-FAQ.html) has more details.
The `bin/macos' directory of a CRAN site contains bin-hexed (`hqx') and
stuffit (`sit') archives for a base distribution and a large number of
add-on packages of R 1.7.1 to run under Mac OS 8.6 to Mac OS 9.2.2. This
port of R for Macintosh is no longer supported.
2.6 Are there Unix binaries for R?
==================================
The `bin/linux' directory of a CRAN site contains the following packages.
CPU Versions Provider
------------------------------------------------------------------------
Debian et al. i386 stable/oldstable Christian Steigies
Red Hat i386 FC3/FC4/FC5/FC6 Martyn Plummer
x86_64 FC3 Brian Ripley
x86_64 FC4/FC5 Martyn Plummer
i386 Enterprise Linux Matthew P. Cox
x86_64 Enterprise Linux Matthew P. Cox
SuSE i386 7.3/8.0/8.1/8.2 Detlef Steuer
i586 9.0/9.1/9.2/9.3/10.0/10.1 Detlef Steuer
x86_64 9.2/9.3/10.0/10.1 Detlef Steuer
Ubuntu i386 dapper Christian Steigies
amd64 dapper Christian Steigies
VineLinux i386 3.2 Susunu Tanimura
Debian packages, maintained by Dirk Eddelbuettel and Doug Bates, have
long been part of the Debian distribution, and can be accessed through APT,
the Debian package maintenance tool. Use e.g. `apt-get install r-base
r-recommended' to install the R environment and recommended packages. If
you also want to build R packages from source, also run `apt-get install
r-base-dev' to obtain the additional tools required for this. So-called
"backports" of the current R packages for the "stable" distribution of
Debian are provided by Christian Steigies, and available from CRAN. Simply
add the line
deb http://cran.R-project.org/bin/linux/debian stable/
(feel free to use a CRAN mirror instead of the master) to the file
`/etc/apt/sources.list', and install as usual. More details on installing
and administering R on Debian Linux can be found at
`http://cran.r-project.org/bin/linux/debian/README'. While the "stable"
backport was built for Debian, it has also been found to be directly usable
for Ubuntu/Kubuntu, and should be suitable for other Debian derivatives.
No other binary distributions are currently publically available via
CRAN.
A "live" Linux distribution with a particular focus on R is "Quantian",
which provides a directly bootable and self-configuring "Live DVD"
containing numerous applications of interests to scientists and
researchers, including several hundred CRAN and Bioconductor packages, the
"ESS" extensions for Emacs, the "JGR" Java GUI for R, the Ggobi
visualization tool as well as several other R interfaces. The "Quantian"
website at `http://dirk.eddelbuettel.com/quantian/' contains more details as
well download information.
2.7 What documentation exists for R?
====================================
Online documentation for most of the functions and variables in R exists,
and can be printed on-screen by typing `help(NAME)' (or `?NAME') at the R
prompt, where NAME 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.)
This documentation can also be made available as one reference manual
for on-line reading in HTML and PDF formats, and as hardcopy via LaTeX, see
*Note How can R be installed?::. An up-to-date HTML version is always
available for web browsing at `http://stat.ethz.ch/R-manual/'.
Printed copies of the R reference manual for some version(s) are
available from Network Theory Ltd, at
`http://www.network-theory.co.uk/R/base/'. For each set of manuals sold,
the publisher donates USD 10 to the R Foundation (*note What is the R
Foundation?::).
The R distribution also comes with the following manuals.
* "An Introduction to R" (`R-intro') includes information on data types,
programming elements, statistical modeling and graphics. This
document is based on the "Notes on S-PLUS" by Bill Venables and David
Smith.
* "Writing R Extensions" (`R-exts') currently describes the process of
creating R add-on packages, writing R documentation, R's system and
foreign language interfaces, and the R API.
* "R Data Import/Export" (`R-data') is a guide to importing and
exporting data to and from R.
* "The R Language Definition" (`R-lang'), a first version of the
"Kernighan & Ritchie of R", explains evaluation, parsing, object
oriented programming, computing on the language, and so forth.
* "R Installation and Administration" (`R-admin').
* "R Internals" (`R-ints') is a guide to R's internal structures.
(Added in R 2.4.0.)
Books on R include
P. Dalgaard (2002), "Introductory Statistics with R", Springer: New
York, ISBN 0-387-95475-9, `http://www.biostat.ku.dk/~pd/ISwR.html'.
J. Fox (2002), "An R and S-PLUS Companion to Applied Regression", Sage
Publications, ISBN 0-761-92280-6 (softcover) or 0-761-92279-2
(hardcover), `http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/'.
J. Maindonald and J. Braun (2003), "Data Analysis and Graphics Using R:
An Example-Based Approach", Cambridge University Press, ISBN
0-521-81336-0, `http://wwwmaths.anu.edu.au/~johnm/'.
S. M. Iacus and G. Masarotto (2002), "Laboratorio di statistica con
R", McGraw-Hill, ISBN 88-386-6084-0 (in Italian),
`http://www.ateneonline.it/LibroAteneo.asp?item_id=1436'.
P. Murrell (2005), "R Graphics", Chapman & Hall/CRC, ISBN:
1-584-88486-X,
`http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html'.
The book
W. N. Venables and B. D. Ripley (2002), "Modern Applied Statistics with
S. Fourth Edition". Springer, ISBN 0-387-95457-0
has a home page at `http://www.stats.ox.ac.uk/pub/MASS4/' providing
additional material. Its companion is
W. N. Venables and B. D. Ripley (2000), "S Programming". Springer,
ISBN 0-387-98966-8
and provides an in-depth guide to writing software in the S language which
forms the basis of both the commercial S-PLUS and the Open Source R data
analysis software systems. See
`http://www.stats.ox.ac.uk/pub/MASS3/Sprog/' for more information.
In addition to material written specifically or explicitly for R,
documentation for S/S-PLUS (see *Note R and S::) can be used in combination
with this FAQ (*note What are the differences between R and S?::).
Introductory books include
P. Spector (1994), "An introduction to S and S-PLUS", Duxbury Press.
A. Krause and M. Olsen (2005), "The Basics of S-PLUS" (Fourth
Edition). Springer, ISBN 0-387-26109-5.
The book
J. C. Pinheiro and D. M. Bates (2000), "Mixed-Effects Models in S and
S-PLUS", Springer, ISBN 0-387-98957-0
provides a comprehensive guide to the use of the *nlme* package for linear
and nonlinear mixed-effects models.
As an example of how R can be used in teaching an advanced introductory
statistics course, see
D. Nolan and T. Speed (2000), "Stat Labs: Mathematical Statistics
Through Applications", Springer Texts in Statistics, ISBN 0-387-98974-9
This integrates theory of statistics with the practice of statistics
through a collection of case studies ("labs"), and uses R to analyze the
data. More information can be found at
`http://www.stat.Berkeley.EDU/users/statlabs/'.
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", _Journal of Computational and Graphical
Statistics_, *5*, 299-314.
An annotated bibliography (BibTeX format) of R-related publications
which includes most of the above references can be found at
`http://www.R-project.org/doc/bib/R.bib'
2.8 Citing R
============
To cite R in publications, use
@Manual{,
title = {R: A Language and Environment for Statistical
Computing},
author = {{R Development Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = 2006,
note = {{ISBN} 3-900051-07-0},
url = {http://www.R-project.org}
}
Citation strings (or BibTeX entries) for R and R packages can also be
obtained by `citation()'.
2.9 What mailing lists exist for R?
===================================
Thanks to Martin Maechler <Martin.Maechler@R-project.org>, there are four
mailing lists devoted to R.
`R-announce'
A moderated list for major announcements about the development of R and
the availability of new code.
`R-packages'
A moderated list for announcements on the availability of new or
enhanced contributed packages.
`R-help'
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.
`R-devel'
This list is for questions and discussion about code development in R.
Please read the posting guide (http://www.R-project.org/posting-guide.html)
_before_ sending anything to any mailing list.
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.
Convenient access to information on these lists, subscription, and
archives is provided by the web interface at
`http://stat.ethz.ch/mailman/listinfo/'. One can also subscribe (or
unsubscribe) via email, e.g. to R-help by sending `subscribe' (or
`unsubscribe') in the _body_ of the message (not in the subject!) to
<R-help-request@lists.R-project.org>.
Send email to <R-help@lists.R-project.org> to send a message to everyone
on the R-help mailing list. Subscription and posting to the other lists is
done analogously, with `R-help' replaced by `R-announce', `R-packages', and
`R-devel', 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.
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.
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 *Note R
Bugs:: for more details.
See `http://www.R-project.org/mail.html' for more information on the R
mailing lists.
The R Core Team can be reached at <R-core@lists.R-project.org> for
comments and reports.
Many of the R project's mailing lists are also available via Gmane
(http://gmane.org), from which they can be read with a web browser, using
an NNTP news reader, or via RSS feeds. See
`http://dir.gmane.org/index.php?prefix=gmane.comp.lang.r.' for the
available mailing lists, and `http://www.gmane.org/rss.php' for details on
RSS feeds.
2.10 What is CRAN?
==================
The "Comprehensive R Archive Network" (CRAN) is a collection of sites which
carry identical material, consisting of the R distribution(s), the
contributed extensions, documentation for R, and binaries.
The CRAN master site at TU Wien, Austria, can be found at the URL
`http://cran.R-project.org/'
Daily mirrors are available at URLs including
`http://cran.at.R-project.org/' (TU Wien, Austria)
`http://cran.au.R-project.org/' (PlanetMirror, Australia)
`http://cran.br.R-project.org/' (Universidade Federal de
Paran, Brazil)
`http://cran.ch.R-project.org/' (ETH Zrich, Switzerland)
`http://cran.dk.R-project.org/' (SunSITE, Denmark)
`http://cran.es.R-project.org/' (Spanish National Research
Network, Madrid, Spain)
`http://cran.fr.R-project.org/' (INRA, Toulouse, France)
`http://cran.hu.R-project.org/' (Semmelweis U, Hungary)
`http://cran.pt.R-project.org/' (Universidade do Porto,
Portugal)
`http://cran.uk.R-project.org/' (U of Bristol, United
Kingdom)
`http://cran.us.R-project.org/' (pair Networks, USA)
`http://cran.za.R-project.org/' (Rhodes U, South Africa)
See `http://cran.R-project.org/mirrors.html' for a complete list of
mirrors. Please use the CRAN site closest to you to reduce network load.
From CRAN, 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, Mac OS X,
and MS Windows). CRAN also provides access to documentation on R, existing
mailing lists and the R Bug Tracking system.
To "submit" to CRAN, simply upload to
`ftp://cran.R-project.org/incoming/' and send an email to
<cran@R-project.org>. Note that CRAN generally does not accept submissions
of precompiled binaries due to security reasons. In particular, binary
packages for Windows and Mac OS X are provided by the respective binary
package maintainers.
Note: It is very important that you indicate the copyright (license)
information (GPL, BSD, Artistic, ...) in your submission.
Please always use the URL of the master site when referring to CRAN.
2.11 Can I use R for commercial purposes?
=========================================
R is released under the GNU General Public License (GPL). 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.
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 GPL, 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 Open Source Definition (http://www.opensource.org/docs/definition.html):
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.
It is also explicitly stated in clause 0 of the GPL, which says in part
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.
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.
None of the discussion in this section constitutes legal advice. The R
Core Team does not provide legal advice under any circumstances.
2.12 Why is R named R?
======================
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' (*note What is S?::).
2.13 What is the R Foundation?
==============================
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 `http://www.R-project.org/foundation/' for
more information.
3 R and S
*********
3.1 What is S?
==============
S is a very high level language and an environment for data analysis and
graphics. In 1998, the Association for Computing Machinery (ACM) presented
its Software System Award to John M. Chambers, the principal designer of S,
for
the S system, which has forever altered the way people analyze,
visualize, and manipulate data ...
S is an elegant, widely accepted, and enduring software system, with
conceptual integrity, thanks to the insight, taste, and effort of John
Chambers.
The evolution of the S language is characterized by four books by John
Chambers and coauthors, which are also the primary references for S.
* Richard A. Becker and John M. Chambers (1984), "S. An Interactive
Environment for Data Analysis and Graphics," Monterey: Wadsworth and
Brooks/Cole.
This is also referred to as the "_Brown Book_", and of historical
interest only.
* Richard A. Becker, John M. Chambers and Allan R. Wilks (1988), "The New
S Language," London: Chapman & Hall.
This book is often called the "_Blue Book_", and introduced what is
now known as S version 2.
* John M. Chambers and Trevor J. Hastie (1992), "Statistical Models in
S," London: Chapman & Hall.
This is also called the "_White Book_", and introduced S version 3,
which added structures to facilitate statistical modeling in S.
* John M. Chambers (1998), "Programming with Data," New York: Springer,
ISBN 0-387-98503-4
(`http://cm.bell-labs.com/cm/ms/departments/sia/Sbook/').
This "_Green Book_" 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.
See `http://cm.bell-labs.com/cm/ms/departments/sia/S/history.html' for
further information on "Stages in the Evolution of S".
There is a huge amount of user-contributed code for S, available at the
S Repository (http://lib.stat.cmu.edu/S/) at CMU.
3.2 What is S-PLUS?
===================
S-PLUS is a value-added version of S sold by Insightful Corporation. Based
on the S language, S-PLUS provides functionality in a wide variety of
areas, including robust regression, modern non-parametric regression, time
series, survival analysis, multivariate analysis, classical statistical
tests, quality control, and graphics drivers. Add-on modules add
additional capabilities.
See the Insightful S-PLUS page
(http://www.insightful.com/products/splus/) for further information.
3.3 What are the differences between R and S?
=============================================
We can regard S as a language with three current implementations or
"engines", the "old S engine" (S version 3; S-PLUS 3.x and 4.x), the "new S
engine" (S version 4; S-PLUS 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 _engines_.
For the remainder of this section, "S" refers to the S engines and not
the S language.
3.3.1 Lexical scoping
---------------------
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 evalutation model in Scheme.
This difference becomes manifest when _free_ 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.
Consider the following function:
cube <- function(n) {
sq <- function() n * n
n * sq()
}
Under S, `sq()' does not "know" about the variable `n' unless it is
defined globally:
S> cube(2)
Error in sq(): Object "n" not found
Dumped
S> n <- 3
S> cube(2)
[1] 18
In R, the "environment" created when `cube()' was invoked is also looked
in:
R> cube(2)
[1] 8
As a more "interesting" real-world problem, suppose you want to write a
function which returns the density function of the r-th order statistic
from a sample of size n 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.)
The S-PLUS documentation for `call()' basically suggests the following:
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
}
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).
A version which makes heavy use of `substitute()' and seems to work
under both S and R is
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)))
}
(the `eval()' is not needed in S).
However, in R there is a much easier solution:
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)
}
}
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).
Note that what you really need is the function _closure_, 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 `MC()' (for "make closure"):
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))
}
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).
For R, `MC()' simply is
MC <- function(f, env) f
(lexical scope!), a version for S is
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)
}
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.
Nested lexically scoped functions allow using function closures and
maintaining local state. A simple example (taken from Abelson and Sussman)
is obtained by typing `demo("scoping")' at the R prompt. Further
information is provided in the standard R reference "R: A Language for Data
Analysis and Graphics" (*note What documentation exists for R?::) and in
Robert Gentleman and Ross Ihaka (2000), "Lexical Scope and Statistical
Computing", _Journal of Computational and Graphical Statistics_, *9*,
491-508.
Nested lexically scoped functions also imply a further major difference.
Whereas S stores all objects as separate files in a directory somewhere
(usually `.Data' 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 _faster_ than S.
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 *Note How can I save my workspace?::)
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 `source()'.
Note: If you run R from within Emacs (see *Note R and Emacs::), you
can save the contents of the interaction buffer to a file and
conveniently manipulate it using `ess-transcript-mode', as well as
save source copies of all functions and data used.
3.3.2 Models
------------
There are some differences in the modeling code, such as
* Whereas in S, you would use `lm(y ~ x^3)' to regress `y' on `x^3', in
R, you have to insulate powers of numeric vectors (using `I()'), i.e.,
you have to use `lm(y ~ I(x^3))'.
* The glm family objects are implemented differently in R and S. The
same functionality is available but the components have different
names.
* Option `na.action' is set to `"na.omit"' by default in R, but not set
in S.
* 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.
* Finally, in R `y ~ x + 0' is an alternative to `y ~ x - 1' for
specifying a model with no intercept. Models with no parameters at all
can be specified by `y ~ 0'.
3.3.3 Others
------------
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.
Some known differences are the following.
* In R, if `x' is a list, then `x[i] <- NULL' and `x[[i]] <- NULL'
remove the specified elements from `x'. The first of these is
incompatible with S, where it is a no-op. (Note that you can set
elements to `NULL' using `x[i] <- list(NULL)'.)
* In S, the functions named `.First' and `.Last' in the `.Data'
directory can be used for customizing, as they are executed at the
very beginning and end of a session, respectively.
In R, the startup mechanism is as follows. R first sources the system
startup file ``$R_HOME'/library/base/R/Rprofile'. Then, it searches
for a site-wide startup profile unless the command line option
`--no-site-file' was given. The name of this file is taken from the
value of the `R_PROFILE' environment variable. If that variable is
unset, the default is ``$R_HOME'/etc/Rprofile.site'
(``$R_HOME'/etc/Rprofile' in versions prior to 1.4.0). This code is
loaded in package *base*. Then, unless `--no-init-file' was given, R
searches for a file called `.Rprofile' in the current directory or in
the user's home directory (in that order) and sources it into the user
workspace. It then loads a saved image of the user workspace from
`.RData' in case there is one (unless `--no-restore' was specified).
If needed, the functions `.First()' and `.Last()' should be defined in
the appropriate startup profiles.
* In R, `T' and `F' are just variables being set to `TRUE' and `FALSE',
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 `"T"' or `"F"'.) Hence, when writing code you should always
use `TRUE' and `FALSE'.
* In R, `dyn.load()' can only load _shared objects_, as created for
example by `R CMD SHLIB'.
* In R, `attach()' currently only works for lists and data frames, but
not for directories. (In fact, `attach()' also works for R data files
created with `save()', which is analogous to attaching directories in
S.) Also, you cannot attach at position 1.
* Categories do not exist in R, and never will as they are deprecated now
in S. Use factors instead.
* In R, `For()' loops are not necessary and hence not supported.
* In R, `assign()' uses the argument `envir=' rather than `where=' as in
S.
* The random number generators are different, and the seeds have
different length.
* R passes integer objects to C as `int *' rather than `long *' as in S.
* R has no single precision storage mode. However, as of version 0.65.1,
there is a single precision interface to C/FORTRAN subroutines.
* By default, `ls()' returns the names of the objects in the current
(under R) and global (under S) environment, respectively. For example,
given
x <- 1; fun <- function() {y <- 1; ls()}
then `fun()' returns `"y"' in R and `"x"' (together with the rest of
the global environment) in S.
* R allows for zero-extent matrices (and arrays, i.e., some elements of
the `dim' 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 `x' is a matrix, `x[, FALSE]' is not
`NULL' but a "matrix" with 0 columns. Hence, such objects need to be
tested for by checking whether their `length()' is zero (which works
in both R and S), and not using `is.null()'.
* Named vectors are considered vectors in R but not in S (e.g.,
`is.vector(c(a = 1:3))' returns `FALSE' in S and `TRUE' in R).
* Data frames are not considered as matrices in R (i.e., if `DF' is a
data frame, then `is.matrix(DF)' returns `FALSE' in R and `TRUE' in S).
* 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.
* In R, the argument of a replacement function which corresponds to the
right hand side must be named `value'. E.g., `f(a) <- b' is evaluated
as `a <- "f<-"(a, value = b)'. S always takes the last argument,
irrespective of its name.
* In S, `substitute()' 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.
* In S, the index variable in a `for()' loop is local to the inside of
the loop. In R it is local to the environment where the `for()'
statement is executed.
* In S, `tapply(simplify=TRUE)' returns a vector where R returns a
one-dimensional array (which can have named dimnames).
* In S(-PLUS) 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 `"aA" < "Bb"' is
true or false). From version 1.2.0 the locale can be (re-)set in R by
the `Sys.setlocale()' function.
* In S, `missing(ARG)' remains `TRUE' if ARG is subsequently modified;
in R it doesn't.
* From R version 1.3.0, `data.frame' strips `I()' when creating (column)
names.
* In R, the string `"NA"' is not treated as a missing value in a
character variable. Use `as.character(NA)' to create a missing
character value.
* R disallows repeated formal arguments in function calls.
* In S, `dump()', `dput()' and `deparse()' are essentially different
interfaces to the same code. In R from version 2.0.0, this is only
true if the same `control' argument is used, but by default it is not.
By default `dump()' tries to write code that will evaluate to
reproduce the object, whereas `dput()' and `deparse()' default to
options for producing deparsed code that is readable.
* In R, indexing a vector, matrix, array or data frame with `[' using a
character vector index looks only for exact matches (whereas `[[' and
`$' allow partial matches). In S, `[' allows partial matches.
* S has a two-argument version of `atan' and no `atan2'. A call in S
such as `atan(x1, x2)' is equivalent to R's `atan2(x1, x2)'. However,
beware of named arguments since S's `atan(x = a, y = b)' is equivalent
to R's `atan2(y = a, x = b)' with the meanings of `x' and `y'
interchanged. (R used to have undocumented support for a two-argument
`atan' with positional arguments, but this has been withdrawn to avoid
further confusion.)
* Numeric constants with no fractional and exponent (i.e., only integer)
part are taken as integer in S-PLUS 6.x or later, but as double in R.
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.
3.4 Is there anything R can do that S-PLUS cannot?
==================================================
Since almost anything you can do in R has source code that you could port
to S-PLUS with little effort there will never be much you can do in R that
you couldn't do in S-PLUS if you wanted to. (Note that using lexical
scoping may simplify matters considerably, though.)
R offers several graphics features that S-PLUS 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 `plotmath', 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", _Journal of
Computational and Graphical Statistics_, *9*, 582-599.
3.5 What is R-plus?
===================
For a very long time, there was no such thing.
XLSolutions Corporation (http://www.xlsolutions-corp.com/) is currently
beta testing a commercially supported version of R named R+ (read R plus).
In addition, REvolution Computing (http://www.revolution-computing.com/)
has released RPro (http://www.revolution-computing.com/rpro.html), an
enterprise-class statistical analysis system based on R, suitable for
deployment in professional, commercial and regulated environments.
4 R Web Interfaces
******************
*Rweb* is developed and maintained by Jeff Banfield
<jeff@math.montana.edu>. The Rweb Home Page
(http://www.math.montana.edu/Rweb/) 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 URL is
provided.
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
(`http://www.jstatsoft.org/v04/i01/').
Ulf Bartel <ulfi@cs.tu-berlin.de> has developed *R-Online*, 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
`http://osvisions.com/r-online/' for more information.
*Rcgi* is a CGI WWW interface to R by MJ Ray <mjr@dsl.pipex.com>. It
had the ability to use "embedded code": you could mix user input and code,
allowing the HTML 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. Currently, a modified version of *Rcgi* by Mai
Zhou <mai@ms.uky.edu> (actually, two versions: one with (bitmap) graphics
and one without) as well as the original code are available from
`http://www.ms.uky.edu/~statweb/'.
CGI-based web access to R is also provided at
`http://hermes.sdu.dk/cgi-bin/go/'. 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
`http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatCompCourse'.
David Firth (http://www.warwick.ac.uk/go/dfirth) has written *CGIwithR*,
an R add-on package available from CRAN. 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 (`http://www.jstatsoft.org/v08/i10/').
The package is now maintained by Duncan Temple Lang
<duncan@wald.ucdavis.edu> and has a web page at
`http://www.omegahat.org/CGIwithR/'.
Rpad (http://www.rpad.org/Rpad), developed and actively maintained by
Tom Short, provides a sophisticated environment which combines some of the
features of the previous approaches with quite a bit of Javascript,
allowing for a GUI-like behavior (with sortable tables, clickable graphics,
editable output), etc.
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
`http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/RApacheProject'.
Rserve (http://stats.math.uni-augsburg.de/Rserve/) 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).
OpenStatServer (http://openstatserver.org/index.html) is being developed
by a team lead by Greg Warnes; it aims "to provide clean access to
computational modules defined in a variety of computational environments
(R, SAS, Matlab, etc) via a single well-defined client interface" and to
turn computational services into web services.
Two projects use PHP to provide a web interface to R. R_PHP_Online
(http://steve-chen.net/R_PHP/) by Steve Chen (though it is unclear if this
project is still active) is somewhat similar to the above Rcgi and Rweb.
R-php (http://dssm.unipa.it/R-php/?cmd=home) 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.
webbioc (http://www.bioconductor.org/) 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.
Finally, Rwui (http://rwui.cryst.bbk.ac.uk) is a web application to 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.
5 R Add-On Packages
*******************
5.1 Which add-on packages exist for R?
======================================
5.1.1 Add-on packages in R
--------------------------
The R distribution comes with the following packages:
*base*
Base R functions (and datasets before R 2.0.0).
*datasets*
Base R datasets (added in R 2.0.0).
*grDevices*
Graphics devices for base and grid graphics (added in R 2.0.0).
*graphics*
R functions for base graphics.
*grid*
A rewrite of the graphics layout capabilities, plus some support for
interaction.
*methods*
Formally defined methods and classes for R objects, plus other
programming tools, as described in the Green Book.
*splines*
Regression spline functions and classes.
*stats*
R statistical functions.
*stats4*
Statistical functions using S4 classes.
*tcltk*
Interface and language bindings to Tcl/Tk GUI elements.
*tools*
Tools for package development and administration.
*utils*
R utility functions.
These "base packages" were substantially reorganized in R 1.9.0. The
former *base* was split into the four packages *base*, *graphics*, *stats*,
and *utils*. Packages *ctest*, *eda*, *modreg*, *mva*, *nls*, *stepfun*
and *ts* were merged into *stats*, package *lqs* returned to the
recommended package *MASS*, and package *mle* moved to *stats4*.
5.1.2 Add-on packages from CRAN
-------------------------------
The following packages are available from the CRAN `src/contrib' area.
(Packages denoted as _Recommended_ are to be included in all binary
distributions of R.)
*AMORE*
A MORE flexible neural network package, providing the TAO robust neural
network algorithm.
*ARES*
Allelic richness estimation, with extrapolation beyond the sample size.
*AdaptFit*
Adaptive semiparametic regression.
*AlgDesign*
Algorithmic experimental designs. Calculates exact and approximate
theory experimental designs for D, A, and I criteria.
*AnalyzeFMRI*
Functions for I/O, visualisation and analysis of functional Magnetic
Resonance Imaging (fMRI) datasets stored in the ANALYZE format.
*ArDec*
Time series autoregressive decomposition.
*BACCO*
Bayesian Analysis of Computer Code Output. Contains *approximator*,
*calibrator*, and *emulator*, for Bayesian prediction of complex
computer codes, calibration of computer models, and emulation of
computer programs, respectively.
*BHH2*
Functions and data sets reproducing some examples in "Statistics for
Experimenters II" by G. E. P. Box, J. S. Hunter, and W. C. Hunter,
2005, John Wiley and Sons.
*BMA*
Bayesian Model Averaging for linear models, generalizable linear models
and survival models (Cox regression).
*BRugs*
OpenBUGS and its R interface BRugs.
*BayesTree*
Bayesian methods for tree based models.
*BayesValidate*
Bayesian software validation using posterior quantiles.
*Bhat*
Functions for general likelihood exploration (MLE, MCMC, CIs).
*BiasedUrn*
Biased urn model distributions.
*Biodem*
A number of functions for biodemographycal analysis.
*Bolstad*
Functions and data sets for the book "Introduction to Bayesian
Statistics" by W. M. Bolstad, 2004, John Wiley and Sons.
*BradleyTerry*
Specify and fit the Bradley-Terry model and structured versions.
*BSDA*
Data sets for the book "Basic Statistics and Data Analysis" by L. J.
Kitchens, 2003, Duxbury.
*BsMD*
Bayes screening and model discrimination follow-up designs.
*CDNmoney*
Components of Canadian monetary aggregates.
*CGIwithR*
Facilities for the use of R to write CGI scripts.
*CTFS*
The CTFS large plot forest dynamics analyses.
*CVThresh*
Level-dependent Cross-Validation Thresholding.
*CircStats*
Circular Statistics, from "Topics in Circular Statistics" by S. Rao
Jammalamadaka and A. SenGupta, 2001, World Scientific.
*CoCo*
Graphical modeling for contingency tables using CoCo.
*CompetingRiskFrailty*
Competing risk model with frailties for right censored survival data.
*CreditMetrics*
Functions for calculating the CreditMetrics risk model.
*DAAG*
Various data sets used in examples and exercises in "Data Analysis and
Graphics Using R" by John H. Maindonald and W. John Brown, 2003.
*DBI*
A common database interface (DBI) class and method definitions. All
classes in this package are virtual and need to be extended by the
various DBMS implementations.
*DCluster*
A set of functions for the detection of spatial clusters of diseases
using count data.
*DDHFm*
Variance stabilization by Data-Driven Haar-Fisz (for microarrays).
*DEoptim*
Differential Evolution Optimization.
*DICOM*
Import and manipulate medical imaging data using the Digital Imaging
and Communications in Medicine (DICOM) Standard.
*DPpackage*
Semiparametric Bayesian analysis using Dirichlet process priors.
*Davies*
Functions for the Davies quantile function and the Generalized Lambda
distribution.
*DescribeDisplay*
R interface to the DescribeDisplay GGobi plugin.
*Design*
Regression modeling, testing, estimation, validation, graphics,
prediction, and typesetting by storing enhanced model design attributes
in the fit. Design is a collection of about 180 functions that assist
and streamline modeling, especially for biostatistical and
epidemiologic applications. It also contains new functions for binary
and ordinal logistic regression models and the Buckley-James multiple
regression model for right-censored responses, and implements
penalized maximum likelihood estimation for logistic and ordinary
linear models. Design works with almost any regression model, but it
was especially written to work with logistic regression, Cox
regression, accelerated failure time models, ordinary linear models,
and the Buckley-James model.
*Devore5*
Data sets and sample analyses from "Probability and Statistics for
Engineering and the Sciences (5th ed)" by Jay L. Devore, 2000, Duxbury.
*Devore6*
Data sets and sample analyses from "Probability and Statistics for
Engineering and the Sciences (6th ed)" by Jay L. Devore, 2003, Duxbury.
*EMV*
Estimation of missing values in a matrix by a k-th nearest neighboors
algorithm.
*EbayesThresh*
Empirical Bayes thresholding and related methods.
*Ecdat*
Data sets from econometrics textbooks.
*ElemStatLearn*
Data sets, functions and examples from the book "The Elements of
Statistical Learning: Data Mining, Inference, and Prediction" by Trevor
Hastie, Robert Tibshirani and Jerome Friedman (2001), Springer.
*Epi*
Statistical analysis in epidemiology, with functions for demographic
and epidemiological analysis in the Lexis diagram.
*FLCore*
Core package of FLR, fisheries modeling in R.
*FLEDA*
Exploratory Data Analysis for FLR.
*FactoMineR*
Factor analysis and data mining with R.
*Fahrmeir*
Data from the book "Multivariate Statistical Modelling Based on
Generalized Linear Models" by Ludwig Fahrmeir and Gerhard Tutz (1994),
Springer.
*Flury*
Data sets from from "A First Course in Multivariate Statistics" by
Bernard Flury (1997), Springer.
*FortranCallsR*
Simple Fortran/C/R interface example.
*FracSim*
Simulation of one- and two-dimensional fractional and multifractional
Levy motions.
*FunCluster*
Functional profiling of cDNA microarray expression data.
*GAMBoost*
Generalized additive models by likelihood based boosting.
*GDD*
Platform and X11 independent device for creating bitmaps (png, gif and
jpeg) using the GD graphics library.
*GPArotation*
Gradient Projection Algorithm rotation for factor analysis.
*GRASS*
An interface between the GRASS geographical information system and R,
based on starting R from within the GRASS environment and chosen
LOCATION_NAME and MAPSET. Wrapper and helper functions are provided
for a range of R functions to match the interface metadata structures.
*GammaTest*
Gamma Test data analysis.
*GenKern*
Functions for generating and manipulating generalised binned kernel
density estimates.
*GeneCycle*
Identification of periodically expressed genes.
*GeneNT*
Relevance or Dependency network and signaling pathway discovery.
*GeneNet*
Modeling and inferring gene networks.
*GeneTS*
A package for analysing multiple gene expression time series data.
Currently, implements methods for cell cycle analysis and for inferring
large sparse graphical Gaussian models.
*Geneland*
MCMC inference from individual genetic data based on a spatial
statistical model.
*GeoXP*
Interactive exploratory spatial data analysis.
*GroupSeq*
Computations related to group-seqential boundaries.
*HH*
Support software for "Statistical Analysis and Data Display" by
Richard M. Heiberger and Burt Holland, Springer, 2005.
*HI*
Simulation from distributions supported by nested hyperplanes.
*HSAUR*
Functions, data sets, analyses and examples from the book "A Handbook
of Statistical Analyses Using R" by Brian S. Everitt and Torsten
Hothorn (2006), Chapman & Hall/CRC.
*HTMLapplets*
Functions inserting dynamic scatterplots and grids in documents
generated by *R2HTML*.
*HighProbability*
Estimation of the alternative hypotheses having frequentist or Bayesian
probabilities at least as great as a specified threshold, given a list
of p-values.
*Hmisc*
Functions useful for data analysis, high-level graphics, utility
operations, functions for computing sample size and power, importing
datasets, imputing missing values, advanced table making, variable
clustering, character string manipulation, conversion of S objects to
LaTeX code, recoding variables, and bootstrap repeated measures
analysis.
*HyperbolicDist*
Basic functions for the hyperbolic distribution: probability density
function, distribution function, quantile function, a routine for
generating observations from the hyperbolic, and a function for fitting
the hyperbolic distribution to data.
*ICE*
Iterated Conditional Expectation: kernel estimators for
interval-censored data.
*IDPmisc*
Utilities from the Institute of Data Analyses and Process Design,
IDP/ZHW.
*IPSUR*
Accompanies "Introduction to Probability and Statistics Using R" by G.
Andy Chang and G. Jay Kerns(in progress).
*ISwR*
Data sets for "Introductory Statistics with R" by Peter Dalgaard,
2002, Springer.
*Icens*
Functions for computing the NPMLE for censored and truncated data.
*InfNet*
Function that simulates an epidemic in a network of contacts.
*JLLprod*
Nonparametric estimation of homothetic and generalized homothetic
production functions.
*JGR*
Java Gui for R.
*JavaGD*
Java Graphics Device.
*JointGLM*
Joint modeling of mean and dispersion through two interlinked GLM's.
_Defunct_ in favor of *JointModeling*.
*JointModeling*
Joint modeling of mean and dispersion.
*KMsurv*
Data sets and functions for "Survival Analysis, Techniques for Censored
and Truncated Data" by Klein and Moeschberger, 1997, Springer.
*Kendall*
Kendall rank correlation and Mann-Kendall trend test.
*KernSmooth*
Functions for kernel smoothing (and density estimation) corresponding
to the book "Kernel Smoothing" by M. P. Wand and M. C. Jones, 1995.
_Recommended_.
*LDheatmap*
Heat maps of linkage disequilibrium measures.
*LMGene*
Date transformation and identification of differentially expressed
genes in gene expression arrays.
*Lmoments*
Estimation of L-moments and the parameters of normal and Cauchy
polynomial quantile mixtures.
*LogicReg*
Routines for Logic Regression.
*LoopAnalyst*
A collection of tools to conduct Levins' Loop Analysis.
*LowRankQP*
Low Rank Quadratic Programming: QP problems where the hessian is
represented as the product of two matrices.
*MASS*
Functions and datasets from the main package of Venables and Ripley,
"Modern Applied Statistics with S". Contained in the `VR' bundle.
_Recommended_.
*MBA*
Multilevel B-spline Approximation.
*MBESS*
Methods for the Behavioral, Educational, and Social Sciences.
*MCMCpack*
Markov chain Monte Carlo (MCMC) package: functions for posterior
simulation for a number of statistical models.
*MChtest*
Monte Carlo hypothesis tests.
*MEMSS*
Data sets and sample analyses from "Mixed-effects Models in S and
S-PLUS" by J. Pinheiro and D. Bates, 2000, Springer.
*MFDA*
Model Based Functional Data Analysis.
*MKLE*
Maximum kernel likelihood estimation.
*MNP*
Fitting Bayesian Multinomial Probit models via Markov chain Monte
Carlo. Along with the standard Multinomial Probit model, it can also
fit models with different choice sets for each observation and
complete or partial ordering of all the available alternatives.
*MPV*
Data sets from the book "Introduction to Linear Regression Analysis"
by D. C. Montgomery, E. A. Peck, and C. G. Vining, 2001, John Wiley and
Sons.
*MSBVAR*
Bayesian vector autoregression models, impulse responses and
forecasting.
*MarkedPointProcess*
Non-parametric analysis of the marks of marked point processes.
*MasterBayes*
Maximum likelihood and Markov chain Monte Carlo methods for pedigree
reconstruction, analysis and simulation.
*MatchIt*
Select matched samples of the original treated and control groups with
similar covariate distributions.
*Matching*
Multivariate and propensity score matching with formal tests of
balance.
*Matrix*
A Matrix package.
*NADA*
Methods described in "Nondetects And Data Analysis: Statistics for
Censored Environmental Data" by Dennis R. Helsel, 2004, John Wiley and
Sons.
*NISTnls*
A set of test nonlinear least squares examples from NIST, the U.S.
National Institute for Standards and Technology.
*NORMT3*
Evaluates complex erf, erfc and density of sum of Gaussian and
Student's t.
*Oarray*
Arrays with arbitrary offsets.
*PBSmapping*
Software evolved from fisheries research conducted at the Pacific
Biological Station (PBS) in Nanaimo, British Columbia, Canada. Draws
maps and implements other GIS procedures.
*PBSmodelling*
Software to facilitate the design, testing, and operation of computer
models.
*PHYLOGR*
Manipulation and analysis of phylogenetically simulated data sets (as
obtained from PDSIMUL in package PDAP) and phylogenetically-based
analyses using GLS.
*PK*
Estimation of pharmacokinetic parameters.
*PKfit*
A nonlinear regression (including a genetic algorithm) program designed
to deal with curve fitting for pharmacokinetics.
*POT*
Generalized Pareto distribution and Peaks Over Threshold.
*PTAk*
A multiway method to decompose a tensor (array) of any order, as a
generalisation of SVD also supporting non-identity metrics and
penalisations. Also includes some other multiway methods.
*PearsonICA*
Independent component analysis using score functions from the Pearson
system.
*ProbForecastGOP*
Probabilistic weather field forecasts using the Geostatistical Output
Perturbation method introduced by Gel, Raftery and Gneiting (2004).
*ProbeR*
Reliability for gene expression from Affymetrix chip.
*QCA*
Qualitative Comparative Analysis for crisp sets.
*QCAGUI*
QCA Graphical User Interface.
*R.matlab*
Read and write of MAT files together with R-to-Matlab connectivity.
*R.oo*
R object-oriented programming with or without references.
*R.rsp*
R server pages.
*R.utils*
Utility classes and methods useful when programming in R and developing
R packages.
*R2HTML*
Functions for exporting R objects & graphics in an HTML document.
*R2WinBUGS*
Running WinBUGS from R: call a BUGS model, summarize inferences and
convergence in a table and graph, and save the simulations in arrays
for easy access in R.
*RArcInfo*
Functions to import Arc/Info V7.x coverages and data.
*RBloomberg*
Fetch data from a Bloomberg API using COM.
*RColorBrewer*
ColorBrewer palettes for drawing nice maps shaded according to a
variable.
*RFA*
Regional Frequency Analysis.
*RGtk2*
Facilities for programming graphical interfaces using Gtk (the Gimp
Tool Kit) version 2.
*RGrace*
Mouse/menu driven interactive plotting application.
*RGraphics*
Data and functions from the book "R Graphics" by Paul Murrell, 2005,
Chapman & Hall/CRC.
*RII*
Estimation of the relative index of inequality for interval-censored
data using natural cubic splines.
*RJaCGH*
Reversible Jump MCMC for the analysis of CGH arrays.
*RLMM*
A genotype calling algorithm for Affymetrix SNP arrays.
*RLadyBug*
Analysis of infectious diseases using stochastic epidemic models.
*RMySQL*
An interface between R and the MySQL database system.
*RNetCDF*
An interface to Unidata's NetCDF library functions (version 3) and
furthermore access to Unidata's udunits calendar conversions.
*ROCR*
Visualizing the performance of scoring classifiers.
*RODBC*
An ODBC database interface.
*ROracle*
Oracle Database Interface driver for R. Uses the ProC/C++ embedded
SQL.
*RQuantLib*
Provides access to (some) of the QuantLib functions from within R;
currently limited to some Option pricing and analysis functions. The
QuantLib project aims to provide a comprehensive software framework for
quantitative finance.
*RSQLite*
Database Interface R driver for SQLite. Embeds the SQLite database
engine in R.
*RScaLAPACK*
An interface to ScaLAPACK functions from R.
*RSvgDevice*
A graphics device for R that uses the new w3.org XML standard for
Scalable Vector Graphics.
*RTisean*
R interface to Tisean algorithms.
*RUnit*
Functions implementing a standard Unit Testing framework, with
additional code inspection and report generation tools.
*RWeka*
An R interface to Weka, a rich collection of machine learning
algorithms for data mining tasks.
*RWinEdt*
A plug in for using WinEdt as an editor for R.
*RXshrink*
Maximum Likelihood Shrinkage via Ridge or Least Angle Regression.
*RadioSonde*
A collection of programs for reading and plotting SKEW-T,log p diagrams
and wind profiles for data collected by radiosondes (the typical
weather balloon-borne instrument).
*RandVar*
Implementation of random variables by means of S4 classes and methods.
*RandomFields*
Creating random fields using various methods.
*RaschSampler*
Sampling binary matrices with fixed margins.
*Rcmdr*
A platform-independent basic-statistics GUI (graphical user interface)
for R, based on the *tcltk* package.
*RcppTemplate*
An illustration of the use of the Rcpp R/C++ interface library.
*ResistorArray*
Electrical properties of resistor networks.
*Rfwdmv*
Forward Search for Multivariate Data.
*Rigroup*
Provides small integer group functions.
*Rlab*
Functions and data sets for the NCSU ST370 class.
*Rlsf*
Interface to the LSF queuing system.
*Rmdr*
R-Multifactor Dimensionality Reduction.
*Rmpi*
An interface (wrapper) to MPI (Message-Passing Interface) APIs. It
also provides an interactive R slave environment in which distributed
statistical computing can be carried out.
*Rpad*
Utility functions for the Rpad workbook-style interface.
*Rserve*
A socket server (TCP/IP or local sockets) which allows binary requests
to be sent to R.
*Rwave*
An environment for the time-frequency analysis of 1-D signals (and
especially for the wavelet and Gabor transforms of noisy signals),
based on the book "Practical Time-Frequency Analysis: Gabor and Wavelet
Transforms with an Implementation in S" by Rene Carmona, Wen L. Hwang
and Bruno Torresani, 1998, Academic Press.
*SASmixed*
Data sets and sample linear mixed effects analyses corresponding to the
examples in "SAS System for Mixed Models" by R. C. Littell, G. A.
Milliken, W. W. Stroup and R. D. Wolfinger, 1996, SAS Institute.
*SIN*
A SINful approach to selection of Gaussian Graphical Markov Models.
*SNPassoc*
SNP-based whole genome association studies.
*SQLiteDF*
Stores data frames and matrices in SQLite tables.
*SciViews*
A bundle of packages to implement a full reusable GUI API for R.
Contains *svGUI* with the main GUI features, *svDialogs* for the
dialog boxes, *svIO* for data import/export, *svMisc* with
miscellaneous supporting functions, and *svViews* providing views and
report features (views are HTML presentations of the content of R
objects, combining text, tables and graphs in the same document).
*SemiPar*
Functions for semiparametric regression analysis, to complement the
book "Semiparametric Regression" by R. Ruppert, M. P. Wand, and R. J.
Carroll, 2003, Cambridge University Press.
*SenSrivastava*
Collection of datasets from "Regression Analysis, Theory, Methods and
Applications" by A. Sen and M. Srivastava, 1990, Springer.
*SensoMineR*
Sensory data analysis.
*SeqKnn*
Sequential KNN imputation.
*SharedHT2*
Shared Hotelling T^2 test for small sample microarray experiments.
*SoPhy*
Soil Physics Tools: simulation of water flux and solute transport in
soil.
*SparseLogReg*
Sparse logistic regression.
*SparseM*
Basic linear algebra for sparse matrices.
*SpherWave*
Spherical Wavelets and SW-based spatially adaptive methods.
*StatDataML*
Read and write StatDataML.
*StoppingRules*
Stopping rules for microarray classifiers.
*SuppDists*
Ten distributions supplementing those built into R (Inverse Gauss,
Kruskal-Wallis, Kendall's Tau, Friedman's chi squared, Spearman's rho,
maximum F ratio, the Pearson product moment correlation coefficiant,
Johnson distributions, normal scores and generalized hypergeometric
distributions).
*SwissAir*
Air quality data of Switzerland for one year in 30 min resolution.
*TRAMPR*
Terminal Restriction Fragment Length Polymorphism (TRFLP) Analysis and
Matching Package for R.
*TSP*
Traveling Salesperson Problem (TSP).
*TWIX*
Trees WIth eXtra splits.
*TeachingDemos*
A set of demonstration functions that can be used in a classroom to
demonstrate statistical concepts, or on your own to better understand
the concepts or the programming.
*TwoWaySurvival*
Additive two-way hazards modeling of right censored survival data.
*UNF*
Tools for creating universal numeric fingerprints for data.
*USPS*
Unsupervised and Supervised methods of Propensity Score adjustment for
bias.
*UsingR*
Data sets to accompany the textbook "Using R for Introductory
Statistics" by J. Verzani, 2005, Chapman & Hall/CRC.
*VDCutil*
Utilities supporting VDC, an open source digital library system for
quantitative data.
*VGAM*
Vector Generalized Linear and Additive Models.
*VLMC*
Functions, classes & methods for estimation, prediction, and simulation
(bootstrap) of VLMC (Variable Length Markov Chain) models.
*VaR*
Methods for calculation of Value at Risk (VaR).
*WWGbook*
Functions and datasets for the book "Linear Mixed Models: A Practical
Guide Using Statistical Software" by B. West, K. Welch, and A. Galecki,
2006, Chapman & Hall/CRC.
*WeedMap*
Map of weed intensity.
*WhatIf*
Software for evaluating counterfactuals.
*XML*
Tools for reading XML documents and DTDs.
*ZIGP*
Zero Inflated Generalized Poisson (ZIGP) regression models.
*Zelig*
Everyone's statistical software: an easy-to-use program that can
estimate, and help interpret the results of, an enormous range of
statistical models.
*aaMI*
Mutual information for protein sequence alignments.
*abind*
Combine multi-dimensional arrays.
*accuracy*
A suite of tools designed to test and improve the accuracy of
statistical computation.
*acepack*
ACE (Alternating Conditional Expectations) and AVAS (Additivity and
VAriance Stabilization for regression) methods for selecting regression
transformations.
*actuar*
Functions related to actuarial science applications.
*ada*
Performs boosting algorithms for a binary response.
*adabag*
Adaboost.M1 and Bagging.
*adapt*
Adaptive quadrature in up to 20 dimensions.
*ade4*
Multivariate data analysis and graphical display.
*ade4TkGUI*
Tcl/Tk Graphical User Interface for *ade4*.
*adehabitat*
A collection of tools for the analysis of habitat selection by animals.
*adimpro*
Adaptive smoothing of digital images.
*adlift*
Adaptive Wavelet transforms for signal denoising.
*agce*
Analysis of growth curve experiments.
*agsemisc*
Miscellaneous plotting and utility functions.
*akima*
Linear or cubic spline interpolation for irregularly gridded data.
*allelic*
A fast, unbiased and exact allelic exact test.
*alr3*
Methods and data to accompany the textbook "Applied Linear Regression"
by S. Weisberg, 2005, Wiley.
*amap*
Another Multidimensional Analysis Package.
*aod*
Analysis of Overdispersed Data.
*apTreeshape*
Analyses of phylogenetic treeshape.
*ape*
Analyses of Phylogenetics and Evolution, providing functions for
reading and plotting phylogenetic trees in parenthetic format
(standard Newick format), analyses of comparative data in a
phylogenetic framework, analyses of diversification and
macroevolution, computing distances from allelic and nucleotide data,
reading nucleotide sequences from GenBank via internet, and several
tools such as Mantel's test, computation of minimum spanning tree, or
the population parameter theta based on various approaches.
*aplpack*
Another PLot PACKage: stem.leaf, bagplot, faces, spin3R, ....
*arules*
Mining association rules and frequent itemsets with R.
*ash*
David Scott's ASH routines for 1D and 2D density estimation.
*aspace*
Estimating centrographic statistics and computational geometries from
spatial point patterns.
*assist*
A suite of functions implementing smoothing splines.
*aster*
Functions and datasets for Aster modeling (forest graph exponential
family conditional or unconditional canonical statistic models for life
history trait modeling).
*asypow*
A set of routines that calculate power and related quantities utilizing
asymptotic likelihood ratio methods.
*aws*
Functions to perform adaptive weights smoothing.
*backtest*
Exploring portfolio-based hypotheses about financial instruments.
*bayesSurv*
Bayesian survival regression with flexible error and (later on also
random effects) distributions.
*bayesm*
Bayes Inference for Marketing/Micro-econometrics.
*bayesmix*
Bayesian mixture models of univariate Gaussian distributions using
JAGS.
*bcp*
Bayesian Change Point based on the Barry and Hartigan product partition
model.
*betareg*
Beta regression for modeling rates and proportions.
*bicreduc*
Reduction algorithm for the NPMLE for the distribution function of
bivariate interval-censored data.
*biglm*
Linear regression for data too large to fit in memory.
*bim*
Bayesian interval mapping diagnostics: functions to interpret QTLCart
and Bmapqtl samples.
*bindata*
Generation of correlated artificial binary data.
*binom*
Binomial confidence intervals for several parameterizations.
*biopara*
Self-contained parallel system for R.
*bitops*
Functions for Bitwise operations on integer vectors.
*bivpois*
Bivariate Poisson models using the EM algorithm.
*blighty*
Function for drawing the coastline of the United Kingdom.
*blockrand*
Randomization for block random clinical trials.
*boa*
Bayesian Output Analysis Program for MCMC.
*boolean*
Boolean logit and probit: a procedure for testing Boolean hypotheses.
*boost*
Boosting methods for real and simulated data, featuring `BagBoost',
`LogitBoost', `AdaBoost', and `L2Boost'.
*boot*
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. _Recommended_.
*bootstrap*
Software (bootstrap, cross-validation, jackknife), data and errata for
the book "An Introduction to the Bootstrap" by B. Efron and R.
Tibshirani, 1993, Chapman and Hall.
*bqtl*
QTL mapping toolkit for inbred crosses and recombinant inbred lines.
Includes maximum likelihood and Bayesian tools.
*brlr*
Bias-reduced logistic regression: fits logistic regression models by
maximum penalized likelihood.
*butler*
Unit testing, profiling and benchmarking for R.
*caMassClass*
Processing and Classification of protein mass spectra (SELDI) data.
*caTools*
Miscellaneous utility functions, including reading/writing ENVI binary
files, a LogitBoost classifier, and a base64 encoder/decoder.
*cacheSweave*
Tools for caching Sweave computations.
*cairoDevice*
Loadable CAIRO/GTK device driver.
*calibrate*
Calibration of biplot axes.
*car*
Companion to Applied Regression, containing functions for applied
regession, linear models, and generalized linear models, with an
emphasis on regression diagnostics, particularly graphical diagnostic
methods.
*cat*
Analysis of categorical-variable datasets with missing values.
*catspec*
Special models for categorical variables.
*cba*
Clustering for Business Analytics, including implementations of
Proximus and Rock.
*cclust*
Convex clustering methods, including k-means algorithm, on-line update
algorithm (Hard Competitive Learning) and Neural Gas algorithm (Soft
Competitive Learning) and calculation of several indexes for finding
the number of clusters in a data set.
*cfa*
Analysis of configuration frequencies.
*cgh*
Analysis of microarray comparative genome hybridisation data using the
Smith-Waterman algorithm.
*chplot*
Augmented convex hull plots: informative and nice plots for grouped
bivariate data.
*changeLOS*
Change in length of hospital stay (LOS).
*chemCal*
Calibration functions for analytical chemistry.
*chron*
A package for working with chronological objects (times and dates).
*circular*
Circular statistics, from "Topics in Circular Statistics" by Rao
Jammalamadaka and A. SenGupta, 2001, World Scientific.
*clac*
Clust Along Chromosomes, a method to call gains/losses in CGH array
data.
*class*
Functions for classification (k-nearest neighbor and LVQ). Contained
in the `VR' bundle. _Recommended_.
*classInt*
Choose univariate class intervals for mapping or other graphics
purposes.
*classPP*
Projection Pursuit for supervised classification.
*classifly*
Explore classification models in high dimensions.
*clim.pact*
Climate analysis and downscaling for monthly and daily data.
*climatol*
Functions to fill missing data in climatological (monthly) series and
to test their homogeneity, plus functions to draw wind-rose and
Walter&Lieth diagrams.
*clines*
Calculates Contour Lines.
*clue*
CLUster Ensembles.
*clustTool*
GUI for clustering data with spatial information.
*cluster*
Functions for cluster analysis. _Recommended_.
*clusterGeneration*
Random cluster generation (with specified degree of separation).
*clusterRepro*
Reproducibility of gene expression clusters.
*clustvarsel*
Variable selection for model-based clustering.
*cmprsk*
Estimation, testing and regression modeling of subdistribution
functions in competing risks.
*cobs99*
Constrained B-splines: outdated 1999 version.
*cobs*
Constrained B-splines: qualitatively constrained (regression) smoothing
via linear programming and sparse matrices.
*cocorresp*
Co-correspondence analysis ordination methods for community ecology.
*coda*
Output analysis and diagnostics for Markov Chain Monte Carlo (MCMC)
simulations.
*coin*
COnditional INference procedures for the general independence problem
including two-sample, K-sample, correlation, censored, ordered and
multivariate problems.
*colorspace*
Mapping between assorted color spaces.
*combinat*
Combinatorics utilities.
*compOverlapCorr*
Comparing overlapping correlation coefficients.
*compositions*
Functions for the consistent analysis of compositional data (e.g.,
portions of substances) and positive numbers (e.g., concentrations).
*concor*
Concordance, providing "SVD by blocks".
*concord*
Measures of concordance and reliability.
*conf.design*
A series of simple tools for constructing and manipulating confounded
and fractional factorial designs.
*connectedness*
Find disconnected sets for two-way classification.
*copula*
Classes of commonly used copulas (including elliptical and
Archimedian), and methods for density, distribution, random number
generators, and plotting.
*corpora*
Utility functions for the statistical analysis of corpus frequency
data.
*corpcor*
Efficient estimation of covariance and (partial) correlation.
*covRobust*
Robust covariance estimation via nearest neighbor cleaning.
*coxrobust*
Robust Estimation in the Cox proportional hazards regression model.
*cramer*
Routine for the multivariate nonparametric Cramer test.
*crossdes*
Functions for the construction and randomization of balanced carryover
balanced designs, to check given designs for balance, and for
simulation studies on the validity of two randomization procedures.
*crq*
Quantile regression for randomly censored data.
*cslogistic*
Likelihood and posterior analysis of conditionally specified logistic
regression models.
*cts*
Continuous time autoregressive models and the Kalman filter.
*ctv*
Server-side and client-side tools for CRAN task views.
*cwhmisc*
Miscellaneous functions by Christian W. Hoffmann.
*cyclones*
Cyclone identification.
*date*
Functions for dealing with dates. The most useful of them accepts a
vector of input dates in any of the forms `8/30/53', `30Aug53', `30
August 1953', ..., `August 30 53', or any mixture of these.
*dblcens*
Calculates the NPMLE of the survival distribution for doubly censored
data.
*deal*
Bayesian networks with continuous and/or discrete variables can be
learned and compared from data.
*debug*
Debugger for R functions, with code display, graceful error recovery,
line-numbered conditional breakpoints, access to exit code, flow
control, and full keyboard input.
*deldir*
Calculates the Delaunay triangulation and the Dirichlet or Voronoi
tesselation (with respect to the entire plane) of a planar point set.
*delt*
Estimation of multivariate densities with adaptive histograms.
*denpro*
Visualization of multivariate density functions and estimates with
level set trees and shape trees, and visualization of multivariate
data with tail trees.
*depmix*
Dependent Mixture Models: fit (multi-group) mixtures of latent Markov
models on mixed categorical and continuous (time series) data.
*dglm*
Double generalized linear models.
*diamonds*
Functions for illustrating aperture-4 diamond partitions in the plane,
or on the surface of an octahedron or icosahedron, for use as analysis
or sampling grids.
*dichromat*
Color schemes for dichromats: collapse red-green distinctions to
simulate the effects of colour-blindness.
*digest*
Two functions for the creation of "hash" digests of arbitrary R
objects using the md5 and sha-1 algorithms permitting easy comparison
of R language objects.
*diptest*
Compute Hartigan's dip test statistic for unimodality.
*dispmod*
Functions for modelling dispersion in GLMs.
*distr*
An object orientated implementation of distributions and some
additional functionality.
*distrEx*
Extensions of package *distr*.
*distrSim*
Simulation classes based on package *distr*.
*distrTEst*
Estimation and Testing classes based on package *distr*.
*distributions*
Probability distributions based on TI-83 Plus.
*diveMove*
Dive analysis and calibration.
*dlm*
Maximum likelihood and Bayesian analysis of Dynamic Linear Models.
*doBy*
Facilities for groupwise computations.
*dprep*
Data preprocessing and visualization functions for classification.
*dr*
Functions, methods, and datasets for fitting dimension reduction
regression, including pHd and inverse regression methods SIR and SAVE.
*drc*
Non-linear regression analysis for multiple curves with focus on
concentration-response, dose-response and time-response curves.
*drfit*
Dose-response data evaluation.
*dse*
Dynamic System Estimation, a multivariate time series package bundle.
Contains *dse1* (the base system, including multivariate ARMA and
state space models), *dse2* (extensions for evaluating estimation
techniques, forecasting, and for evaluating forecasting model),
*tframe* (functions for writing code that is independent of the
representation of time), and *setRNG* (a mechanism for generating the
same random numbers in S and R).
*dyn*
Time series regression.
*dynamicGraph*
Interactive graphical tool for manipulating graphs.
*dynlm*
Dynamic linear models and time series regression.
*e1071*
Miscellaneous functions used at the Department of Statistics at TU Wien
(E1071), including moments, short-time Fourier transforms, Independent
Component Analysis, Latent Class Analysis, support vector machines, and
fuzzy clustering, shortest path computation, bagged clustering, and
some more.
*eRm*
Estimating extended Rasch models.
*eba*
Fitting and testing probabilistic choice models, especially the BTL,
elimination-by-aspects (EBA), and preference tree (Pretree) models.
*eco*
Fitting Bayesian models of ecological inference in 2 by 2 tables.
*ecodist*
Dissimilarity-based functions for ecological analysis.
*edci*
Edge Detection and Clustering in Images.
*effects*
Graphical and tabular effect displays, e.g., of interactions, for
linear and generalised linear models.
*eha*
A package for survival and event history analysis.
*eiPack*
Ecological inference and higher-dimension data management.
*elasticnet*
Elastic net regularization and variable selection.
*ellipse*
Package for drawing ellipses and ellipse-like confidence regions.
*elliptic*
A suite of elliptic and related functions including Weierstrass and
Jacobi forms.
*elrm*
Exact Logistic Regression via MCMC.
*emme2*
Functions to read from and write to an EMME/2 databank.
*emplik*
Empirical likelihood ratio for means/quantiles/hazards from possibly
right censored data.
*energy*
E-statistics (energy) tests for comparing distributions: multivariate
normality, Poisson test, multivariate k-sample test for equal
distributions, hierarchical clustering by e-distances.
*ensembleBMA*
Probabilistic forecasting using Bayesian Model Averaging of ensembles
using a mixture of normal distributions.
*epicalc*
Epidemiological calculator.
*epitools*
Basic tools for applied epidemiology.
*epsi*
Edge Preserving Smoothing for Images.
*equivalence*
Tests and graphics for assessing tests of equivalence.
*evd*
Functions for extreme value distributions. Extends simulation,
distribution, quantile and density functions to univariate, bivariate
and (for simulation) multivariate parametric extreme value
distributions, and provides fitting functions which calculate maximum
likelihood estimates for univariate and bivariate models.
*evdbayes*
Functions for the bayesian analysis of extreme value models, using MCMC
methods.
*evir*
Extreme Values in R: Functions for extreme value theory, which may be
divided into the following groups; exploratory data analysis, block
maxima, peaks over thresholds (univariate and bivariate), point
processes, gev/gpd distributions.
*exactLoglinTest*
Monte Carlo exact tests for log-linear models.
*exactRankTests*
Computes exact p-values and quantiles using an implementation of the
Streitberg/Roehmel shift algorithm.
*exactmaxsel*
Exact methods for maximally selected statistics for binary response
variables.
*fBasics*
The Rmetrics module for "Markets, basic statistics, and stylized
facts". Rmetrics is an environment and software collection for
teaching financial engineering and computational finance
(`http://www.Rmetrics.org/').
*fCalendar*
The Rmetrics module for "Date, Time and Calendars".
*fEcofin*
The Rmetrics module with "Selected economic and financial data sets".
*fExtremes*
The Rmetrics module for "Beyond the Sample, Dealing with Extreme
Values".
*fMultivar*
The Rmetrics module for "Multivariate Data Analysis".
*fOptions*
The Rmetrics module for "The Valuation of Options".
*fPortfolio*
The Rmetrics module for "Pricing and Hedging of Options".
*fSeries*
The Rmetrics module for "The Dynamical Process Behind Financial
Markets".
*far*
Modelization for Functional AutoRegressive processes.
*faraway*
Functions and datasets for books by Julian Faraway.
*fastICA*
Implementation of FastICA algorithm to perform Independent Component
Analysis (ICA) and Projection Pursuit.
*fda*
Functional Data Analysis: analysis of data where the basic observation
is a function of some sort.
*fdim*
Functions for calculating fractal dimension.
*fdrtool*
Estimation and control of (local) False Discovery Rates.
*feature*
Feature significance for multivariate kernel density estimation.
*femmeR*
Output analysis of FEMME model results.
*ffmanova*
Fifty-fifty MANOVA.
*fgac*
Families of Generalized Archimedean Copulas.
*fields*
A collection of programs for curve and function fitting with an
emphasis on spatial data. The major methods implemented include cubic
and thin plate splines, universal Kriging and Kriging for large data
sets. The main feature is that any covariance function implemented in
R can be used for spatial prediction.
*filehash*
Simple file-based hash table.
*filehashSQLite*
Simple key-value database using SQLite as the backend.
*financial*
Solving financial problems in R.
*fingerprint*
Functions to operate on binary fingerprint data.
*flexclust*
Flexible cluster algorithms.
*flexmix*
Flexible Mixture Modeling: a general framework for finite mixtures of
regression models using the EM algorithm.
*fmri*
Functions for the analysis of fMRI experiments.
*forecasting*
A bundle with functions and datasets for forecasting. Contains
*forecast* (time series forecasting), *fma* (data sets from the book
"Forecasting: Methods and Applications" by Makridakis, Wheelwright &
Hyndman, 1998), and *Mcomp* (data from the M-competitions).
*foreign*
Functions for reading and writing data stored by statistical software
like Minitab, S, SAS, SPSS, Stata, Systat, etc. _Recommended_.
*fork*
Functions for handling multiple processes: simple wrappers around the
Unix process management API calls.
*fortunes*
R fortunes.
*forward*
Forward search approach to robust analysis in linear and generalized
linear regression models.
*fpc*
Fixed point clusters, clusterwise regression and discriminant plots.
*fracdiff*
Maximum likelihood estimation of the parameters of a fractionally
differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
Statistics, 1989).
*frailtypack*
Fit a shared gamma frailty model and Cox proportional hazards model
using a Penalized Likelihood on the hazard function.
*ftnonpar*
Features and strings for nonparametric regression.
*fuzzyRankTests*
Fuzzy rank tests and confidence intervals.
*g.data*
Create and maintain delayed-data packages (DDP's).
*gRbase*
A package for graphical modelling in R. Defines S4 classes for
graphical meta data and graphical models, and illustrates how
hierarchical log-linear models may be implemented and combined with
*dynamicGraph*.
*gRcox*
Inference in graphical gaussian models with edge and vertex symmetries.
*gWidgets*
gWidgets API for building toolkit-independent, interactive GUIs.
*gWidgetsRGtk2*
Toolkit implementation of gWidgets for RGtk2.
*gafit*
Genetic algorithm for curve fitting.
*gam*
Functions for fitting and working with Generalized Additive Models, as
described in chapter 7 of the White Book, and in "Generalized Additive
Models" by T. Hastie and R. Tibshirani (1990).
*gamair*
Data sets used in the book "Generalized Additive Models: An
Introduction with R" by S. Wood (2006).
*gamlss*
Functions to fit Generalized Additive Models for Location Scale and
Shape.
*gamlss.dist*
Extra distributions for GAMLSS modeling.
*gamlss.nl*
A GAMLSS add on package for fitting non linear parametric models.
*gamlss.tr*
A GAMLSS add on for generating and fitting truncated (gamlss.family)
distributions.
*gap*
Genetic analysis package for both population and family data.
*gbev*
Gradient Boosted regression trees with Errors-in-Variables.
*gbm*
Generalized Boosted Regression Models: implements extensions to Freund
and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
machine. Includes regression methods for least squares, absolute loss,
logistic, Poisson, Cox proportional hazards partial likelihood, and
AdaBoost exponential loss.
*gclus*
Clustering Graphics. Orders panels in scatterplot matrices and
parallel coordinate displays by some merit index.
*gcmrec*
Parameters estimation of the general semiparametric model for recurrent
event data proposed by Pea and Hollander.
*gdata*
Various functions to manipulate data.
*gee*
An implementation of the Liang/Zeger generalized estimating equation
approach to GLMs for dependent data.
*geepack*
Generalized estimating equations solver for parameters in mean, scale,
and correlation structures, through mean link, scale link, and
correlation link. Can also handle clustered categorical responses.
*genalg*
R based genetic algorithm for binary and floating point chromosomes.
*genetics*
Classes and methods for handling genetic data. Includes classes to
represent genotypes and haplotypes at single markers up to multiple
markers on multiple chromosomes, and functions for allele frequencies,
flagging homo/heterozygotes, flagging carriers of certain alleles,
computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
*geoR*
Functions to perform geostatistical data analysis including model-based
methods.
*geoRglm*
Functions for inference in generalised linear spatial models.
*geometry*
Mesh generation and surface tesselation, based on the Qhull library.
*ggm*
Functions for defining directed acyclic graphs and undirected graphs,
finding induced graphs and fitting Gaussian Markov models.
*ggplot*
Grammar of graphics based plots for R.
*giRaph*
Data structures and algorithms for computations on graphs.
*gld*
Basic functions for the generalised (Tukey) lambda distribution.
*gllm*
Routines for log-linear models of incomplete contingency tables,
including some latent class models via EM and Fisher scoring
approaches.
*glmmML*
A Maximum Likelihood approach to generalized linear models with random
intercept.
*glmpath*
L1 regularization path for Generalized Linear Models.
*glpk*
Interface to the GNU Linear Programming Kit (GLPK).
*gmodels*
Various functions to manipulate models.
*gmp*
Arithmetic "without limitations" using the GNU Multiple Precision
library.
*gmt*
Interface between the GMT 4.0 map-making software and R.
*gnm*
Functions to specify and fit generalized nonlinear models, including
models with multiplicative interaction terms such as the UNIDIFF model
from sociology and the AMMI model from crop science.
*gpclib*
General polygon clipping routines for R based on Alan Murta's C
library.
*gpls*
Classification using generalized partial least squares for two-group
and multi-group (more than 2 group) classification.
*gplots*
Various functions to draw plots.
*grImport*
Importing vector graphics.
*grasper*
Generalized Regression Analysis and Spatial Predictions for R.
*gregmisc*
Miscellaneous functions written/maintained by Gregory R. Warnes.
*gridBase*
Integration of base and grid graphics.
*grnnR*
A Generalized Regression Neural Network.
*grouped*
Regression models for grouped and coarse data, under the Coarsened At
Random assumption.
*grplasso*
Fit user specified models with group lasso penalty.
*gsl*
Wrapper for special functions of the Gnu Scientific Library (GSL).
*gss*
A comprehensive package for structural multivariate function estimation
using smoothing splines.
*gstat*
multivariable geostatistical modelling, prediction and simulation.
Includes code for variogram modelling; simple, ordinary and universal
point or block (co)kriging, sequential Gaussian or indicator
(co)simulation, and map plotting functions.
*gsubfn*
Miscellaneous string utilities.
*gtkDevice*
GTK graphics device driver that may be used independently of the
R-GNOME interface and can be used to create R devices as embedded
components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
*gtools*
Various functions to help manipulate data.
*gvlma*
Global Validation of Linear Models Assumptions.
*hapassoc*
Likelihood inference of trait associations with SNP haplotypes and
other attributes using the EM Algorithm.
*haplo.ccs*
Estimate haplotype relative risks in case-control data.
*haplo.stats*
Statistical analysis of haplotypes with traits and covariates when
linkage phase is ambiguous.
*hapsim*
Haplotype data simulation.
*hddplot*
Use known groups in high-dimensional data to derive scores for plots.
*hdf5*
Interface to the NCSA HDF5 library.
*hdrcde*
Highest Density Regions and Conditional Density Estimation.
*hett*
Functions for the fitting and summarizing of heteroscedastic
t-regression.
*hier.part*
Hierarchical Partitioning: variance partition of a multivariate data
set.
*hierfstat*
Estimation of hierarchical F-statistics from haploid or diploid genetic
data with any numbers of levels in the hierarchy, and tests for the
significance of each F and variance components.
*hmm.discnp*
Hidden Markov models with discrete non-parametric observation
distributions.
*hoa*
A bundle of packages for higher order likelihood-based inference.
Contains *cond* for approximate conditional inference for logistic and
loglinear models, *csampling* for conditional simulation in
regression-scale models, *marg* for approximate marginal inference for
regression-scale models, and *nlreg* for higher order inference for
nonlinear heteroscedastic models.
*homals*
Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
*homtest*
Homogeneity tests for regional frequency analysis.
*hopach*
Hierarchical Ordered Partitioning and Collapsing Hybrid (HOPACH).
*hot*
Computation on micro-arrays.
*howmany*
A lower bound for the number of correct rejections.
*httpRequest*
Implements HTTP Request protocols (GET, POST, and multipart POST
requests).
*hwde*
Models and tests for departure from Hardy-Weinberg equilibrium and
independence between loci.
*hybridHclust*
Hybrid hierarchical clustering via mutual clusters.
*ifa*
Independent Factor Analysis.
*ifs*
Iterated Function Systems distribution function estimator.
*igraph*
Routines for simple graphs.
*iid.test*
Testing whether data is independent and identically distributed.
*impute*
Imputation for microarray data (currently KNN only).
*ineq*
Inequality, concentration and poverty measures, and Lorenz curves
(empirical and theoretic).
*intcox*
Implementation of the Iterated Convex Minorant Algorithm for the Cox
proportional hazard model for interval censored event data.
*iplots*
Interactive graphics for R.
*ipred*
Improved predictive models by direct and indirect bootstrap aggregation
in classification and regression as well as resampling based estimators
of prediction error.
*irr*
Coefficients of Interrater Reliability and Agreement for quantitative,
ordinal and nominal data.
*ismev*
Functions to support the computations carried out in "An Introduction
to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
Springer. The functions may be divided into the following groups;
maxima/minima, order statistics, peaks over thresholds and point
processes.
*its*
An S4 class for handling irregular time series.
*kappalab*
The "laboratory for capacities", an S4 tool box for capacity (or
non-additive measure, fuzzy measure) and integral manipulation on a
finite setting.
*kernlab*
Kernel-based machine learning methods including support vector
machines.
*kinship*
Mixed-effects Cox models, sparse matrices, and modeling data from large
pedigrees.
*kknn*
Weighted k-nearest neighbors classification and regression.
*klaR*
Miscellaneous functions for classification and visualization developed
at the Department of Statistics, University of Dortmund.
*km.ci*
Confidence intervals for the Kaplan-Meier estimator.
*knnFinder*
Fast nearest neighbor search.
*knnTree*
Construct or predict with k-nearest-neighbor classifiers, using
cross-validation to select k, choose variables (by forward or
backwards selection), and choose scaling (from among no scaling,
scaling each column by its SD, or scaling each column by its MAD).
The finished classifier will consist of a classification tree with one
such k-nn classifier in each leaf.
*knncat*
Nearest-neighbor classification with categorical variables.
*kohonen*
Supervised and unsupervised self-organising maps.
*ks*
Kernel smoothing: bandwidth matrices for kernel density estimators and
kernel discriminant analysis for bivariate data.
*kza*
Kolmogorov-Zurbenko Adpative filter for locating change points in a
time series.
*kzft*
Kolmogorov-Zurbenko Fourier Transform and application.
*labdsv*
Laboratory for Dynamic Synthetic Vegephenomenology.
*labstatR*
Functions for the book "Laboratorio di statistica con R" by S. M.
Iacus and G. Masarotto, 2002, McGraw-Hill. Function names and
documentation in Italian.
*lars*
Least Angle Regression, Lasso and Forward Stagewise: efficient
procedures for fitting an entire lasso sequence with the cost of a
single least squares fit.
*laser*
Likelihood Analysis of Speciation/Extinction Rates from phylogenies.
*lasso2*
Routines and documentation for solving regression problems while
imposing an L1 constraint on the estimates, based on the algorithm of
Osborne et al. (1998).
*latentnet*
Latent position and cluster models for statistical networks.
*lattice*
Lattice graphics, an implementation of Trellis Graphics functions.
_Recommended_.
*latticeExtra*
Generic functions and standard methods for Trellis-based displays.
*lawstat*
Statistical tests widely utilized in biostatistics, public policy and
law.
*lazy*
Lazy learning for local regression.
*ldDesign*
Design of experiments for detection of linkage disequilibrium,
*ldbounds*
Lan-DeMets method for group sequential boundaries.
*leaps*
A package which performs an exhaustive search for the best subsets of a
given set of potential regressors, using a branch-and-bound algorithm,
and also performs searches using a number of less time-consuming
techniques.
*lgtdl*
A set of methods for longitudinal data objects.
*lhs*
Latin Hypercube Samples.
*limma*
LInear Models for MicroArray data.
*linprog*
Solve linear programming/linear optimization problems by using the
simplex algorithm.
*lme4*
Fit linear and generalized linear mixed-effects models.
*lmeSplines*
Fit smoothing spline terms in Gaussian linear and nonlinear
mixed-effects models.
*lmm*
Linear mixed models.
*lmomco*
L-moments and L-comoments.
*lmtest*
A collection of tests on the assumptions of linear regression models
from the book "The linear regression model under test" by W. Kraemer
and H. Sonnberger, 1986, Physica.
*locfdr*
Computation of local false discovery rates.
*locfit*
Local Regression, likelihood and density estimation.
*lodplot*
Assorted plots of location score versus genetic map position.
*logcondens*
Estimate a log-concave probability density from i.i.d. observations.
*logistf*
Firth's bias reduced logistic regression approach with penalized
profile likelihood based confidence intervals for parameter estimates.
*logspline*
Logspline density estimation.
*lokern*
Kernel regression smoothing with adaptive local or global plug-in
bandwidth selection.
*longmemo*
Datasets and Functionality from the textbook "Statistics for
Long-Memory Processes" by J. Beran, 1994, Chapman & Hall.
*lpSolve*
Functions that solve general linear/integer problems, assignment
problems, and transportation problems via interfacing Lp_solve.
*lpridge*
Local polynomial (ridge) regression.
*lsa*
Latent Semantic Analysis.
*lspls*
LS-PLS (least squares -- partial least squares) models.
*ltm*
Analysis of multivariate Bernoulli data using latent trait models
(including the Rasch model) under the Item Response Theory approach.
*lvplot*
Letter-value box plots.
*mAr*
Estimation of multivariate AR models through a computationally
efficient stepwise least-squares algorithm.
*mFilter*
Miscellenous time series filters.
*maanova*
Analysis of N-dye Micro Array experiments using mixed model effect.
Contains anlysis of variance, permutation and bootstrap, cluster and
consensus tree.
*magic*
A variety of methods for creating magic squares of any order greater
than 2, and various magic hypercubes.
*mapLD*
Linkage Disequilibrium mapping.
*mapdata*
Supplement to package *maps*, providing the larger and/or
higher-resolution databases.
*mapproj*
Map Projections: converts latitude/longitude into projected
coordinates.
*maps*
Draw geographical maps. Projection code and larger maps are in
separate packages.
*maptools*
Set of tools for manipulating and reading geographic data, in
particular ESRI shapefiles.
*maptree*
Functions with example data for graphing and mapping models from
hierarchical clustering and classification and regression trees.
*mathgraph*
Tools for constructing and manipulating objects from a class of
directed and undirected graphs.
*matlab*
Emulate MATLAB code using R.
*maxstat*
Maximally selected rank and Gauss statistics with several p-value
approximations.
*mblm*
Median-based Linear models, using Theil-Sen single or Siegel repeated
medians.
*mboost*
Gradient boosting for fitting generalized linear, additive and
interaction models.
*mcgibbsit*
Warnes and Raftery's MCGibbsit MCMC diagnostic.
*mclust*
Model-based clustering and normal mixture modeling including Bayesian
regularization.
*mclust02*
Model-based cluster analysis: the 2002 version of MCLUST.
*mcmc*
Functions for Markov Chain Monte Carlo (MCMC).
*mda*
Code for mixture discriminant analysis (MDA), flexible discriminant
analysis (FDA), penalized discriminant analysis (PDA), multivariate
additive regression splines (MARS), adaptive back-fitting splines
(BRUTO), and penalized regression.
*merror*
Accuracy and precision of measurements.
*meta*
Fixed and random effects meta-analysis, with functions for tests of
bias, forest and funnel plot.
*mfp*
Multiple Fractional Polynomials.
*mgcv*
Routines for GAMs and other genralized ridge regression problems with
multiple smoothing parameter selection by GCV or UBRE. _Recommended_.
*micEcon*
Tools for microeconomic analysis and microeconomic modelling.
*mice*
Multivariate Imputation by Chained Equations.
*mimR*
An R interface to MIM for graphical modeling in R.
*minpack.lm*
R interface for two functions from the MINPACK least squares
optimization library, solving the nonlinear least squares problem by a
modification of the Levenberg-Marquardt algorithm.
*misc3d*
A collection of miscellaneous 3d plots, including rgl-based
isosurfaces.
*mitools*
Tools to perform analyses and combine results from multiple-imputation
datasets.
*mix*
Estimation/multiple imputation programs for mixed categorical and
continuous data.
*mixreg*
Functions to fit mixtures of regressions.
*mixtools*
Tools for mixture models.
*mlCopulaSelection*
Copula selection and fitting using maximum likelihood.
*mlbench*
A collection of artificial and real-world machine learning benchmark
problems, including the Boston housing data.
*mlica*
Independent Component Analysis using Maximum Likelihood.
*mlmRev*
Examples from Multilevel Modelling Software Review.
*mmlcr*
Mixed-mode latent class regression (also known as mixed-mode mixture
model regression or mixed-mode mixture regression models) which can
handle both longitudinal and one-time responses.
*mnormt*
The multivariate normal and t distributions.
*moc*
Fits a variety of mixtures models for multivariate observations with
user-difined distributions and curves.
*modeltools*
A collection of tools to deal with statistical models.
*moments*
Moments, skewness, kurtosis and related tests.
*monreg*
Estimation of monotone regression and variance functions in
nonparametric models.
*monoProc*
Strictly monotone smoothing procedure.
*mprobit*
Multivariate probit model for binary/ordinal response.
*mratios*
Inferences for ratios of coefficients in the general linear model.
*msgcop*
Semiparametric Bayesian Gaussian copula estimation.
*msm*
Functions for fitting continuous-time Markov multi-state models to
categorical processes observed at arbitrary times, optionally with
misclassified responses, and covariates on transition or
misclassification rates.
*muhaz*
Hazard function estimation in survival analysis.
*multcomp*
Multiple comparison procedures for the one-way layout.
*multcompView*
Visualizations of paired comparisons.
*multic*
Quantitative linkage analysis tools using the variance components
approach.
*multilevel*
Analysis of multilevel data by organizational and social psychologists.
*multinomRob*
Overdispersed multinomial regression using robust (LQD and tanh)
estimation.
*multtest*
Resampling-based multiple hypothesis testing.
*mvbutils*
Utilities by Mark V. Bravington for project organization, editing and
backup, sourcing, documentation (formal and informal), package
preparation, macro functions, and more.
*mvnmle*
ML estimation for multivariate normal data with missing values.
*mvnormtest*
Generalization of the Shapiro-Wilk test for multivariate variables.
*mvtnormpcs*
Multivariate Normal and T Distribution functions of Dunnett (1989).
*mvoutlier*
Multivariate outlier detection based on robust estimates of location
and covariance structure.
*mvpart*
Multivariate partitioning.
*mvtnorm*
Multivariate normal and t distributions.
*nFDR*
Nonparametric Estimate of FDR Based on Bernstein polynomials.
*nFactors*
Non-graphical solution to the Cattell Scree Test.
*ncdf*
Interface to Unidata netCDF data files.
*ncomplete*
Functions to perform the regression depth method (RDM) to binary
regression to approximate the minimum number of observations that can
be removed such that the reduced data set has complete separation.
*ncvar*
High-level R interface to netCDF datasets.
*negenes*
Estimating the number of essential genes in a genome on the basis of
data from a random transposon mutagenesis experiment, through the use
of a Gibbs sampler.
*network*
Tools to create and modify network objects, which can represent a range
of relational data types.
*neural*
RBF and MLP neural networks with graphical user interface.
*nice*
Get or set UNIX priority (niceness) of running R process.
*nlme*
Fit and compare Gaussian linear and nonlinear mixed-effects models.
_Recommended_.
*nlmeODE*
Combine the *nlme* and *odesolve* packages for mixed-effects modelling
using differential equations.
*nltm*
NonLinear Transformation Models for survival analysis.
*nnet*
Software for single hidden layer perceptrons ("feed-forward neural
networks"), and for multinomial log-linear models. Contained in the
`VR' bundle. _Recommended_.
*nor1mix*
One-dimensional normal mixture models classes, for, e.g., density
estimation or clustering algorithms research and teaching; providing
the widely used Marron-Wand densities.
*norm*
Analysis of multivariate normal datasets with missing values.
*normalp*
A collection of utilities for normal of order p distributions (General
Error Distributions).
*nortest*
Five omnibus tests for the composite hypothesis of normality.
*noverlap*
Functions to perform the regression depth method (RDM) to binary
regression to approximate the amount of overlap, i.e., the minimal
number of observations that need to be removed such that the reduced
data set has no longer overlap.
*np*
Nonparametric kernel smoothing methods for mixed datatypes.
*npmc*
Nonparametric Multiple Comparisons: provides simultaneous rank test
procedures for the one-way layout without presuming a certain
distribution.
*numDeriv*
Accurate numerical derivatives.
*nws*
Functions for NetWorkSpaces and Sleigh.
*odesolve*
An interface for the Ordinary Differential Equation (ODE) solver lsoda.
ODEs are expressed as R functions.
*odfWeave*
Sweave processing of Open Document Format (ODF) files.
*onion*
A collection of routines to manipulate and visualize quaternions and
octonions.
*optmatch*
Functions to perform optimal matching, particularly full matching.
*orientlib*
Representations, conversions and display of orientation SO(3) data.
*ouch*
Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses.
*outliers*
A collection of some tests commonly used for identifying outliers.
*oz*
Functions for plotting Australia's coastline and state boundaries.
*pARtial*
(Partial) attributable risk estimates, corresponding variance estimates
and confidence intervals.
*paleoTS*
Modeling evolution in paleontological time-series.
*pamr*
Pam: Prediction Analysis for Microarrays.
*pan*
Multiple imputation for multivariate panel or clustered data.
*panel*
Functions and datasets for fitting models to Panel data.
*papply*
Parallel apply function using MPI.
*partitions*
Additive partitions of integers.
*partsm*
Periodic AutoRegressive Time Series Models.
*party*
Unbiased recursive partitioning in a conditional inference framework.
*pastecs*
Package for Analysis of Space-Time Ecological Series.
*pbatR*
Frontend to PBAT to run within R.
*pcaPP*
Robust PCA by Projection Pursuit.
*pcalg*
Standard and robust estimation of the skeleton (ugraph) of a Directed
Acyclic Graph (DAG) via the PC algorithm.
*pcurve*
Fits a principal curve to a numeric multivariate dataset in arbitrary
dimensions. Produces diagnostic plots. Also calculates Bray-Curtis
and other distance matrices and performs multi-dimensional scaling and
principal component analyses.
*pear*
Periodic Autoregression Analysis.
*permax*
Functions intended to facilitate certain basic analyses of DNA array
data, especially with regard to comparing expression levels between two
types of tissue.
*permtest*
Permutation test to compare variability within and distance between two
groups.
*perturb*
Perturbation analysis for evaluating collinearity.
*pgam*
Poisson-Gamma Additive Models.
*pgirmess*
Functions for analysis and display of ecological and spatial data.
*pheno*
Some easy-to-use functions for time series analyses of (plant-)
phenological data sets.
*phpSerialize*
Serialize R to PHP associative array.
*pinktoe*
Converts S trees to HTML/Perl files for interactive tree traversal.
*pixmap*
Functions for import, export, plotting and other manipulations of
bitmapped images.
*plm*
Linear models for panel data.
*plotrix*
Various useful functions for enhancing plots.
*plugdensity*
Kernel density estimation with global bandwidth selection via
"plug-in".
*pls*
Partial Least Squares Regression (PLSR) and Principal Component
Regression (PCR).
*plsgenomics*
PLS analyses for genomics.
*pmg*
Poor Man's GUI.
*poLCA*
POlytomous variable Latent Class Analysis.
*polspline*
Routines for the polynomial spline fitting routines hazard regression,
hazard estimation with flexible tails, logspline, lspec, polyclass, and
polymars, by C. Kooperberg and co-authors.
*polyapost*
Simulating from the Polya posterior.
*polycor*
Polychoric and polyserial correlations.
*polynom*
A collection of functions to implement a class for univariate
polynomial manipulations.
*popgen*
Statistical and POPulation GENetics.
*portfolio*
Classes for analyzing and implementing portfolios.
*portfolioSim*
Framework for simulating equity portfolio strategies.
*powell*
Optimizes a function using Powell's UObyQA algorithm.
*powerpkg*
Power analyses for the affected sib pair and the TDT design.
*ppc*
Sample classification of protein mass spectra by peak probabilty
contrasts.
*pps*
Functions to select samples using PPS (probability proportional to
size) sampling, for stratified simple random sampling, and to compute
joint inclusion probabilities for Sampford's method of PPS sampling.
*prabclus*
Distance based parametric bootstrap tests for clustering, mainly
thought for presence-absence data (clustering of species distribution
maps). Jaccard and Kulczynski distance measures, clustering of MDS
scores, and nearest neighbor based noise detection.
*prettyR*
Pretty descriptive stats.
*princurve*
Fits a principal curve to a matrix of points in arbitrary dimension.
*proptest*
Tests of the proportional hazards assumption in the Cox model.
*proto*
An object oriented system using prototype or object-based (rather than
class-based) object oriented ideas.
*pscl*
R in the Political Science Computational Laboratory, Stanford
University.
*pspline*
Smoothing splines with penalties on order m derivatives.
*psy*
Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
screeplot, PCA and related methods.
*psychometric*
Applied psychometric theory: functions useful for correlation theory,
meta-analysis (validity-generalization), reliability, item analysis,
inter-rater reliability, and classical utility.
*pwr*
Basic functions for power analysis.
*pwt*
The Penn World Table providing purchasing power parity and national
income accounts converted to international prices for 168 countries for
some or all of the years 1950-2000.
*pvclust*
Hierarchical clustering with p-value.
*qcc*
Quality Control Charts. Shewhart quality control charts for
continuous, attribute and count data. Cusum and EWMA charts.
Operating characteristic curves. Process capability analysis. Pareto
chart and cause-and-effect chart.
*qp*
q-order partial correlation graph search algorithm.
*qtl*
Analysis of experimental crosses to identify QTLs.
*qtlDesign*
Tools for the design of QTL experiments.
*qtlbim*
QTL Bayesian Interval Mapping.
*quadprog*
For solving quadratic programming problems.
*quantchem*
Quantitative chemical analysis: calibration and evaluation of results.
*quantreg*
Quantile regression and related methods.
*quantregForest*
Quantile Regression Forests, a tree-based ensemble method for
estimation of conditional quantiles.
*qvalue*
Q-value estimation for false discovery rate control.
*qvcalc*
Functions to compute quasi-variances and associated measures of
approximation error.
*rJava*
Low-level R to Java interface. Allows creation of objects, calling
methods and accessing fields.
*race*
Implementation of some racing methods for the empirical selection of
the best.
*rake*
Raking survey datasets by re-weighting.
*randaes*
Random number generator based on AES cipher.
*random*
True random numbers using random.org.
*randomSurvivalForest*
Ishwaran and Kogalur's random survival forest.
*randomForest*
Breiman's random forest classifier.
*rankreg*
Rank regression estimator for the AFT model with right censored data.
*rattle*
A graphical user interface for data mining in R using GTK.
*rbugs*
Functions to prepare files needed for running BUGS in batch mode, and
running BUGS from R. Support for Linux systems with Wine is
emphasized.
*rcdd*
C Double Description for R, an interface to the CDD computational
geometry library.
*rcdk*
Interface to the CDK libraries, a Java framework for cheminformatics.
*rcom*
R COM Client Interface and internal COM Server.
*rcompletion*
TAB completion for R using Readline.
*rda*
Shrunken Centroids Regularized Discriminant Analysis.
*ref*
Functions for creating references, reading from and writing ro
references and a memory efficient refdata type that transparently
encapsulates matrices and data frames.
*regress*
Fitting Gaussian linear models where the covariance structure is a
linear combination of known matrices by maximising the residual log
likelihood. Can be used for multivariate models and random effects
models.
*relaimpo*
RELAtive IMPOrtance of regressors in linear models.
*relax*
Functions for report writing, presentation, and programming.
*reldist*
Functions for the comparison of distributions, including nonparametric
estimation of the relative distribution PDF and CDF and numerical
summaries as described in "Relative Distribution Methods in the Social
Sciences" by Mark S. Handcock and Martina Morris, 1999, Springer.
*relimp*
Functions to facilitate inference on the relative importance of
predictors in a linear or generalized linear model.
*relsurv*
Various functions for regression in relative survival.
*reshape*
Flexibly reshape data.
*resper*
Sampling from restricted permutations.
*reweight*
Adjustment of survey respondent weights.
*rgdal*
Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
Library (GDAL).
*rgenoud*
R version of GENetic Optimization Using Derivatives.
*rggm*
Robustified methods for Gaussian Graphical Models.
*rggobi*
Interface between R and GGobi.
*rgl*
3D visualization device system (OpenGL).
*rhosp*
Side effect risks in hospital: simulation and estimation.
*rimage*
Functions for image processing, including Sobel filter, rank filters,
fft, histogram equalization, and reading JPEG files.
*riv*
Robust Instrumental Variables estimators based on high breakpoint point
S-estimators of multivariate location and scatter matrices.
*rjacobi*
Jacobi polynomials and Gauss-Jacobi quadrature related operations.
*rlecuyer*
R interface to RNG with multiple streams.
*rmeta*
Functions for simple fixed and random effects meta-analysis for
two-sample comparison of binary outcomes.
*rmetasim*
An interface between R and the metasim simulation engine. Facilitates
the use of the metasim engine to build and run individual based
population genetics simulations.
*roblm*
Robust regression estimators.
*robust*
Insightful robust package.
*robustbase*
Basic Robust Statistics.
*rpanel*
Simple interactive controls for R using the tcltk package.
*rpart*
Recursive PARTitioning and regression trees. _Recommended_.
*rpart.permutation*
Permutation tests of rpart models.
*rpubchem*
R interface to the PubChem collection.
*rpvm*
R interface to PVM (Parallel Virtual Machine). Provides interface to
PVM APIs, and examples and documentation for its use.
*rqmcmb2*
Markov chain marginal bootstrap for quantile regression.
*rrcov*
Functions for robust location and scatter estimation and robust
regression with high breakdown point.
*rrp*
Random Recursive Partitioning.
*rsprng*
Provides interface to SPRNG (Scalable Parallel Random Number
Generators) APIs, and examples and documentation for its use.
*rstream*
Unified object oriented interface for multiple independent streams of
random numbers from different sources.
*rtiff*
Read TIFF format images and return them as pixmap objects.
*rv*
Simulation-based random variable object class.
*rwt*
Rice Wavelet Toolbox wrapper, providing a set of functions for
performing digital signal processing.
*sac*
Semiparametric empirical likelihood ratio based test of changepoint
with one-change or epidemic alternatives with data-based model
diagnostic.
*sampling*
A set of tools to select and to calibrate samples.
*sampfling*
Implements a modified version of the Sampford sampling algorithm.
Given a quantity assigned to each unit in the population, samples are
drawn with probability proportional to te product of the quantities of
the units included in the sample.
*samr*
Significance Analysis of Microarrays.
*sandwich*
Model-robust standard error estimators for time series and longitudinal
data.
*sca*
Simple Component Analysis.
*scaleboot*
Approximately unbiased p-values via multiscale bootstrap.
*scape*
functions to import and plot results from statistical catch-at-age
models, used in fisheries stock assessments.
*scapeMCMC*
Markov-chain Monte Carlo diagnostic plots, accompanying the *scape*
package.
*scatterplot3d*
Plots a three dimensional (3D) point cloud perspectively.
*sciplot*
Scientific graphing functions for factorial designs.
*scope*
Data manipulation using arbitrary row and column criteria.
*scuba*
Scuba diving calculations and decompression models.
*seacarb*
Calculates parameters of the seawater carbonate system.
*seas*
Detailed seasonal plots of temperature and precipitation data.
*seewave*
Time wave analysis and graphical representation.
*segmented*
Functions to estimate break-points of segmented relationships in
regression models (GLMs).
*sem*
Functions for fitting general linear Structural Equation Models (with
observed and unobserved variables) by the method of maximum likelihood
using the RAM approach.
*sensitivity*
Sensitivity analysis.
*seqinr*
Exploratory data analysis and data visualization for biological
sequence (DNA and protein) data.
*seqmon*
Sequential monitoring of clinical trials.
*session*
Functions for interacting with, saving and restoring R sessions.
*setRNG*
Set (normal) random number generator and seed.
*sfsmisc*
Utilities from Seminar fuer Statistik ETH Zurich.
*sgeostat*
An object-oriented framework for geostatistical modeling.
*shapefiles*
Functions to read and write ESRI shapefiles.
*shapes*
Routines for the statistical analysis of shapes, including procrustes
analysis, displaying shapes and principal components, testing for mean
shape difference, thin-plate spline transformation grids and edge
superimposition methods.
*sigma2tools*
Test of hypothesis about sigma2.
*simecol*
SIMulation of ECOLogical (and other) dynamic systems.
*simex*
SIMEX and MCSIMEX algorithms for measurement error models.
*simpleboot*
Simple bootstrap routines.
*skewt*
Density, distribution function, quantile function and random generation
for the skewed t distribution of Fernandez and Steel.
*sm*
Software linked to the book "Applied Smoothing Techniques for Data
Analysis: The Kernel Approach with S-PLUS Illustrations" by A. W.
Bowman and A. Azzalini, 1997, Oxford University Press.
*sma*
Functions for exploratory (statistical) microarray analysis.
*smatr*
(Standardized) Major Axis estimation and Testing Routines.
*smoothSurv*
Survival regression with smoothed error distribution.
*sn*
Functions for manipulating skew-normal probability distributions and
for fitting them to data, in the scalar and the multivariate case.
*sna*
A range of tools for social network analysis, including node and
graph-level indices, structural distance and covariance methods,
structural equivalence detection, p* modeling, and network
visualization.
*snow*
Simple Network of Workstations: support for simple parallel computing
in R.
*snowFT*
Fault Tolerant Simple Network of Workstations.
*som*
Self-Organizing Maps (with application in gene clustering).
*sound*
A sound interface for R: Basic functions for dealing with `.wav' files
and sound samples.
*sp*
A package that provides classes and methods for spatial data, including
utility functions for plotting data as maps, spatial selection, amd
much more.
*spBayes*
Fit Gaussian models with potentially complex hierarchical error
structures by Markov chain Monte Carlo (MCMC).
*spatclus*
Arbitrarily shaped multiple spatial cluster detection for case event
data.
*spatial*
Functions for kriging and point pattern analysis from "Modern Applied
Statistics with S" by W. Venables and B. Ripley. Contained in the
`VR' bundle. _Recommended_.
*spatialCovariance*
Computation of spatial covariance matrices for data on rectangles using
one dimensional numerical integration and analytic results.
*spatialkernel*
Nonparameteric estimation of spatial segregation in a multivariate
point process.
*spatstat*
Data analysis and modelling of two-dimensional point patterns,
including multitype points and spatial covariates.
*spc*
Statistical Process Control: evaluation of control charts by means of
the zero-state, steady-state ARL (Average Run Length), setting up
control charts for given in-control ARL, and plotting of the related
figures.
*spdep*
A collection of functions to create spatial weights matrix objects from
polygon contiguities, from point patterns by distance and tesselations,
for summarising these objects, and for permitting their use in spatial
data analysis; a collection of tests for spatial autocorrelation,
including global Moran's I and Geary's C, local Moran's I, saddlepoint
approximations for global and local Moran's I; and functions for
estimating spatial simultaneous autoregressive (SAR) models. (Was
formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
*spe*
Stochastic Proximity Embedding.
*spectralGP*
Approximate Gaussian processes using the Fourier basis.
*spectrino*
Spectra organizer, visualization and data extraction from within R.
*spgrass6*
Interface between the GRASS 6.0 geographical information system and R.
*spgwr*
Geographically weighted regression.
*splancs*
Spatial and space-time point pattern analysis functions.
*ssanv*
Sample Size Adjusted for Nonadherence or Variability of input
parameters.
*sspir*
State SPace models In R.
*st*
Shrinkage t statistic.
*startupmsg*
Utilities for start-up messages.
*statmod*
Miscellaneous biostatistical modelling functions.
*stepPlr*
L2 penalized logistic regression with a stepwise variable selection.
*stepwise*
A stepwise approach to identifying recombination breakpoints in a
sequence alignment.
*stinepack*
Stineman interpolation package.
*stochmod*
Learning and inference algorithms for a variety of probabilistic
models.
*strucchange*
Various tests on structural change in linear regression models.
*subselect*
A collection of functions which assess the quality of variable subsets
as surrogates for a full data set, and search for subsets which are
optimal under various criteria.
*sudoku*
Sudoku puzzle solver.
*supclust*
Methodology for supervised grouping of predictor variables.
*superpc*
Supervised principal components.
*survBayes*
Fits a proportional hazards model to time to event data by a Bayesian
approach.
*surveillance*
Outbreak detection algorithms for surveillance data.
*survey*
Summary statistics, generalized linear models, and general maximum
likelihood estimation for stratified, cluster-sampled, unequally
weighted survey samples.
*survival*
Functions for survival analysis, including penalised likelihood.
_Recommended_.
*survrec*
Survival analysis for recurrent event data.
*svcR*
A support vector machine technique for clustering.
*svmpath*
Computes the entire regularization path for the two-class svm
classifier with essentialy the same cost as a single SVM fit.
*systemfit*
Contains functions for fitting simultaneous systems of equations using
Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
Three-Stage Least Squares (3SLS).
*tapiR*
Tools for accessing (UK) parliamentary information in R.
*taskPR*
Task-Parallel R package.
*tcltk2*
A series of widgets and functions to supplement *tcltk*.
*tdist*
Computes the distribution of a linear combination of independent
Student's t variables.
*tdm*
A tool for Therapeutic Drug Monitoring.
*tdthap*
Transmission/disequilibrium tests for extended marker haplotypes.
*tensor*
Tensor product of arrays.
*tensorA*
Advanced tensors arithmetic with named indices.
*tgp*
Bayesian regression and adaptive sampling with Treed Gaussian Process
models.
*time*
Time tracking for developers.
*titan*
Titration analysis for mass spectrometry data.
*titecrm*
TIme-To-Event Continual Reassessment Method and calibration tools.
*tkrplot*
Simple mechanism for placing R graphics in a Tk widget.
*tlnise*
Two-level normal independent sampling estimation.
*triangle*
Standard distribution functions for the triangle distribution.
*tree*
Classification and regression trees.
*treeglia*
Stem analysis functions for volume increment and carbon uptake
assessment from tree-rings.
*trimcluster*
Cluster analysis with trimming.
*trip*
Spatial analysis of animal track data.
*tripack*
A constrained two-dimensional Delaunay triangulation package.
*truncgof*
Goodness-of-fit tests allowing for left truncated data.
*trust*
Local optimization using two derivatives and trust regions.
*tsDyn*
Time series analysis based on dynamical systems theory.
*tseries*
Package for time series analysis with emphasis on non-linear modelling.
*tseriesChaos*
Routines for the analysis of non-linear time series.
*tsfa*
Time Series Factor Analysis.
*tuneR*
Collection of tools to analyze music, handle wave files, transcription,
etc.
*tutoR*
Student-friendly package to mask common functions.
*twang*
Toolkit for Weighting and Analysis of Nonequivalent Groups.
*tweedie*
Maximum likelihood computations for Tweedie exponential family models.
*udunits*
Interface to Unidata's routines to convert units.
*ump*
Uniformly Most Powerful tests.
*unbalhaar*
Function estimation via Unbalanced Haar wavelets.
*untb*
Ecological drift under the UNTB (Unified Neutral Theory of
Biodiversity).
*urca*
Unit root and cointegration tests for time series data.
*urn*
Functions for sampling without replacement (simulated urns).
*uroot*
Unit root tests and graphics for seasonal time series.
*vabayelMix*
Variational Bayesian mixture model.
*varSelRF*
Variable selection using random forests.
*vardiag*
Interactive variogram diagnostics.
*varmixt*
Mixture model on the variance for the analysis of gene expression data.
*vars*
VAR modeling.
*vcd*
Functions and data sets based on the book "Visualizing Categorical
Data" by Michael Friendly.
*vegan*
Various help functions for vegetation scientists and community
ecologists.
*verification*
Utilities for verification of discrete and probabilistic forecasts.
*verify*
Construction of test suites using verify objects.
*vioplot*
Violin plots, which are a combination of a box plot and a kernel
density plot.
*wavelets*
Functions for computing wavelet filters, wavelet transforms and
multiresolution analyses.
*waveslim*
Basic wavelet routines for time series analysis.
*wavethresh*
Software to perform 1-d and 2-d wavelet statistics and transforms.
*wccsom*
SOM networks for comparing patterns with peak shifts.
*wle*
Robust statistical inference via a weighted likelihood approach.
*wnominate*
WNOMINATE roll call analysis software.
*xgobi*
Interface to the XGobi and XGvis programs for graphical data analysis.
*xlsReadWrite*
Natively read and write Excel files.
*xtable*
Export data to LaTeX and HTML tables.
*zicounts*
Fit classical, zero-inflated and interval censored count data
regression models.
*zipfR*
Statistical models for word frequency distributions.
*zoo*
A class with methods for totally ordered indexed observations such as
irregular time series.
See CRAN `src/contrib/PACKAGES' for more information.
There is also a CRAN `src/contrib/Devel' directory which contains
packages still "under development" or depending on features only present in
the current development versions of R. Volunteers are invited to give
these a try, of course. This area of CRAN currently contains
*GLMMGibbs*
Generalised Linear Mixed Models by Gibbs sampling.
*RPgSQL*
Provides methods for accessing data stored in PostgreSQL tables.
*dseplus*
Extensions to *dse*, the Dynamic Systems Estimation multivariate time
series package. Contains PADI, juice and monitoring extensions.
*ensemble*
Ensembles of tree classifiers.
*runStat*
Running median and mean.
*write.snns*
Function for writing a SNNS pattern file from a data frame or matrix.
5.1.3 Add-on packages from Omegahat
-----------------------------------
The Omegahat Project for Statistical Computing (http://www.omegahat.org/)
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 CRAN style R package repository is
available via `http://www.omegahat.org/R/'.
Currently, there are the following packages.
*Aspell*
An interface to facilities in the aspell library.
*CGIwithR*
Facilities for the use of R to write CGI scripts.
*CORBA*
Dynamic CORBA client/server facilities for R. Connects to other
CORBA-aware applications developed in arbitrary languages, on different
machines and allows R functionality to be exported in the same way to
other applications.
*Combinations*
Compute the combinations of choosing r items from n elements.
*IDocs*
Infrastructure for interactive documents.
*OOP*
OOP style classes and methods for R and S-PLUS. Object references and
class-based method definition are supported in the style of languages
such as Java and C++.
*RCurl*
Allows one to compose HTTP requests to fetch URIs, post forms, etc.,
and process the results returned by the Web server.
*RDCOMClient*
Provides dynamic client-side access to (D)COM applications from within
R.
*RDCOMEvents*
Provides facilities to use R functions and objects as handlers for DCOM
events.
*RDCOMServer*
Facilities for exporting S objects and functions as COM objects.
*REmbeddedPostgres*
Allows R functions and objects to be used to implement SQL functions --
per-record, aggregate and trigger functions.
*REventLoop*
An abstract event loop mechanism that is toolkit independent and can be
used to to replace the R event loop.
*Rexif*
Extract meta-information from JPEG files.
*RGdkPixbuf*
S language functions to access the facilities in the GdkPixbuf library
for manipulating images.
*RGnumeric*
A plugin for the Gnumeric spreadsheet that allows R functions to be
called from cells within the sheet, automatic recalculation, etc.
*RGtk*
Facilities in the S language for programming graphical interfaces using
Gtk, the Gnome GUI toolkit.
*RGtkBindingGenerator*
A meta-package which generates C and R code to provide bindings to a
Gtk-based library.
*RGtkExtra*
A collection of S functions that provide an interface to the widgets in
the gtk+extra library such as the GtkSheet data-grid display, icon
list, file list and directory tree.
*RGtkGlade*
S language bindings providing an interface to Glade, the interactive
Gnome GUI creator.
*RGtkHTML*
A collection of S functions that provide an interface to creating and
controlling an HTML widget which can be used to display HTML documents
from files or content generated dynamically in S.
*RGtkIPrimitives*
A collection of low-level primitives for interactive use with R
graphics and the gtkDevice using *RGtk*.
*RGtkViewers*
A collection of tools for viewing different S objects, databases, class
and widget hierarchies, S source file contents, etc.
*RJavaDevice*
A graphics device for R that uses Java components and graphics. APIs.
*RMatlab*
A bi-directional interface between R and Matlab.
*RObjectTables*
The C and S code allows one to define R objects to be used as elements
of the search path with their own semantics and facilities for reading
and writing variables. The objects implement a simple interface via R
functions (either methods or closures) and can access external data,
e.g., in other applications, languages, formats, ...
*RSMethods*
An implementation of S version 4 methods and classes for R, consistent
with the basic material in "Programming with Data" by John M.
Chambers, 1998, Springer NY.
*RSPerl*
An interface from R to an embedded, persistent Perl interpreter,
allowing one to call arbitrary Perl subroutines, classes and methods.
*RSPython*
Allows Python programs to invoke S functions, methods, etc., and S code
to call Python functionality.
*RXLisp*
An interface to call XLisp-Stat functions from within R.
*Rcompression*
In-memory decompression for GNU zip and bzip2 formats.
*Rlibstree*
Suffix Trees in R via the libstree C library.
*Rstem*
Interface to Snowball implementation of Porter's word stemming
algorithm.
*Ryacas*
R interface to yacas.
*SASXML*
Example for reading XML files in SAS 8.2 manner.
*SJava*
An interface from R to Java to create and call Java objects and
methods.
*SLanguage*
Functions and C support utilities to support S language programming
that can work in both R and S-PLUS.
*SNetscape*
Plugin for Netscape and JavaScript.
*SSOAP*
A client interface to SOAP (Simple Object Access Protocol) servers from
within S.
*SWinRegistry*
Provides access from within R to read and write the Windows registry.
*SWinTypeLibs*
Provides ways to extract type information from type libraries and/or
DCOM objects that describes the methods, properties, etc., of an
interface.
*SXalan*
Process XML documents using XSL functions implemented in R and
dynamically substituting output from R.
*Slcc*
Parses C source code, allowing one to analyze and automatically
generate interfaces from S to that code, including the table of
S-accessible native symbols, parameter count and type information, S
constructors from C objects, call graphs, etc.
*Sxslt*
An extension module for libxslt, the XML-XSL document translator, that
allows XSL functions to be implemented via R functions.
*XML*
Tools for reading XML documents and DTDs.
5.1.4 Add-on packages from Bioconductor
---------------------------------------
The Bioconductor Project (http://www.bioconductor.org/) produces an open
source software framework that will assist biologists and statisticians
working in bioinformatics, with primary emphasis on inference using DNA
microarrays. A CRAN style R package repository is available via
`http://www.bioconductor.org/'.
The following R packages are contained in the current release of
Bioconductor, with more packages under development.
*AnnBuilder*
Assemble and process genomic annotation data, from databases such as
GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
Human Genome Project.
*Biobase*
Object-oriented representation and manipulation of genomic data (S4
class structure).
*Biostrings*
Class definitions and generics for biological sequences along with
pattern matching algorithms.
*Category*
A collection of tools for performing category analysis.
*ChromoViz*
Draw gene expression profile onto chromosome using SVG.
*CoCiteStats*
A collection of software tools for dealing with co-citation data.
*DEDS*
Differential Expression via Distance Summary for microarray data.
*DNAcopy*
Segments DNA copy number data using circular binary segmentation to
detect regions with abnormal copy number.
*DynDoc*
Functionality to create and interact with dynamic documents, vignettes,
and other navigable documents.
*EBImage*
R image processing toolkit.
*EBarrays*
Empirical Bayes tools for the analysis of replicated microarray data
across multiple conditions.
*GEOquery*
Get data from NCBI Gene Expression Omnibus (GEO).
*GLAD*
Gain and Loss Analysis of DNA.
*GOstats*
Tools for manipulating GO and microarrays.
*GeneMeta*
A collection of meta-analysis tools for analyzing high throughput
experimental data.
*GeneR*
Package manipulating nucleotidic sequences (Embl, Fasta, GenBank).
*GeneSpring*
Functions and class definitions to be able to read and write GeneSpring
specific data objects and convert them to Bioconductor objects.
*GeneTS*
A package for analysing multiple gene expression time series data.
Currently, implements methods for cell cycle analysis and for inferring
large sparse graphical Gaussian models.
*GeneTraffic*
GeneTraffic R integration functions.
*GenomeBase*
Base functions for genome data package manipulation.
*GlobalAncova*
Calculates a global test for differential gene expression between
groups.
*GraphAT*
Graph theoretic Association Tests.
*HEM*
Heterogeneous Error Model for analysis of microarray data.
*Heatplus*
A heat map displaying covariates and coloring clusters.
*Icens*
Functions for computing the NPMLE for censored and truncated data.
*KEGGSOAP*
Client-side SOAP access KEGG.
*LMGene*
Analysis of microarray data using a linear model and glog data
transformation.
*LPE*
Significance analysis of microarray data with small number of
replicates using the Local Pooled Error (LPE) method.
*MANOR*
Micro-Array NORmalization.
*MCRestimate*
Misclassification error estimation with cross-validation.
*MLInterfaces*
Uniform interfaces to machine learning code for the exprSet class from
Bioconductor.
*MVCClass*
Model-View-Controller (MVC) classes.
*MantelCorr*
Compute Mantel Cluster Correlations.
*MeasurementError.cor*
Two-stage measurement error model for correlation estimation with
smaller bias than the usual sample correlation.
*MergeMaid*
Cross-study comparison of gene expression array data.
*Mfuzz*
Soft clustering of time series gene expression data.
*MiPP*
Misclassification Penalized Posterior Classification.
*OCplus*
Operating characteristics plus sample size and local fdr for microarray
experiments.
*OLIN*
Optimized Local Intensity-dependent Normalisation of two-color
microarrays.
*OLINgui*
Graphical user interface for *OLIN*.
*OrderedList*
Similarities of ordered gene lists.
*PROcess*
Ciphergen SELDI-TOF processing.
*RBGL*
An interface between the graph package and the Boost graph libraries,
allowing for fast manipulation of graph objects in R.
*RLMM*
A genotype calling algorithm for Affymetrix SNP arrays.
*RMAGEML*
Functionality to handle MAGEML documents.
*RMAPPER*
Interface to mapper.chip.org.
*ROC*
Receiver Operating Characteristic (ROC) approach for identifying genes
that are differentially expressed in two types of samples.
*RSNPper*
Interface to chip.org::SNPper for SNP-related data.
*RankProd*
Rank Product method for identifying differentially expressed genes.
*RdbiPgSQL*
Methods for accessing data stored in PostgreSQL tables.
*Rdbi*
Generic framework for database access in R.
*Resourcerer*
Read annotation data from TIGR Resourcerer or convert the annotation
data into Bioconductor data package.
*Rgraphviz*
An interface with Graphviz for plotting graph objects in R.
*Ruuid*
Creates Universally Unique ID values (UUIDs) in R.
*SAGElyzer*
Locates genes based on SAGE tags.
*SBMLR*
Systems Biology Markup Language (SBML) interface and biochemical system
analysis tools.
*SNAData*
Data from the book "Social Network Analysis" by Wasserman & Faust,
1999.
*ScISI*
In Silico Interactome.
*aCGH*
Classes and functions for Array Comparative Genomic Hybridization data.
*adSplit*
Annotation-driven clustering.
*affxparser*
Package for parsing Affymetrix files (CDF, CEL, CHP, BPMAP, BAR).
*affy*
Methods for Affymetrix Oligonucleotide Arrays.
*affyQCReport*
QC Report Generation for affyBatch objects.
*affyPLM*
For fitting Probe Level Models.
*affycomp*
Graphics toolbox for assessment of Affymetrix expression measures.
*affycoretools*
Functions useful for those doing repetitive analyses.
*affydata*
Affymetrix data for demonstration purposes.
*affyio*
Tools for parsing Affymetrix data files.
*affylmGUI*
Graphical User Interface for affy analysis using package *limma*.
*affypdnn*
Probe Dependent Nearest Neighbors (PDNN) for the affy package.
*altcdfenvs*
Utilities to handle cdfenvs.
*annaffy*
Functions for handling data from Bioconductor Affymetrix annotation
data packages.
*annotate*
Associate experimental data in real time to biological metadata from
web databases such as GenBank, LocusLink and PubMed. Process and store
query results. Generate HTML reports of analyses.
*apComplex*
Estimate protein complex membership using AP-MS protein data.
*applera*
Tools for Applied Biosystems microarrays AB1700 data analysis and
quality controls.
*arrayMagic*
Utilities for quality control and processing for two-color cDNA
microarray data.
*arrayQuality*
Performing print-run and array level quality assessment.
*beadarray*
Quality control and low-level analysis of BeadArrays.
*bim*
Bayesian interval mapping diagnostics: functions to interpret QTLCart
and Bmapqtl samples.
*bioDist*
A collection of software tools for calculating distance measures.
*biocViews*
Categorized views of R package repositories.
*biomaRt*
Interface to BioMart databases (e.g., Ensembl)
*bridge*
Bayesian Robust Inference for Differential Gene Expression.
*cellHTS*
Analysis of cell-based screens.
*cghMCR*
Find chromosome regions showing common gains/losses.
*clusterStab*
Compute cluster stability scores for microarray data.
*codelink*
Manipulation of Codelink Bioarrays data.
*convert*
Convert Microarray Data Objects.
*copa*
Functions to perform cancer outlier profile analysis.
*ctc*
Tools to export and import Tree and Cluster to other programs.
*daMA*
Functions for the efficient design of factorial two-color microarray
experiments and for the statistical analysis of factorial microarray
data.
*diffGeneAnalysis*
Performs differential Gene expression Analysis.
*ecolitk*
Metadata and tools to work with E. coli.
*edd*
Expression density diagnostics: graphical methods and pattern
recognition algorithms for distribution shape classification.
*exprExternal*
Implementation of exprSet using externalVectors.
*externalVector*
Basic class definitions and generics for external pointer based vector
objects for R.
*factDesign*
A set of tools for analyzing data from factorial designed microarray
experiments. The functions can be used to evaluate appropriate tests
of contrast and perform single outlier detection.
*fdrame*
FDR Adjustments of Microarray Experiments (FDR-AME).
*gcrma*
Background adjustment using sequence information.
*genArise*
A tool for dual color microarray data.
*geneRecommender*
A gene recommender algorithm to identify genes coexpressed with a query
set of genes.
*genefilter*
Tools for sequentially filtering genes using a wide variety of
filtering functions. Example of filters include: number of missing
value, coefficient of variation of expression measures, ANOVA p-value,
Cox model p-values. Sequential application of filtering functions to
genes.
*geneplotter*
Graphical tools for genomic data, for example for plotting expression
data along a chromosome or producing color images of expression data
matrices.
*gff3Plotter*
Plotting data of experiments on the genomic layout.
*globaltest*
Testing globally whether a group of genes is significantly related to
some clinical variable of interest.
*goCluster*
Analysis of clustering results in conjunction with annotation data.
*goTools*
Functions for description/comparison of oligo ID list using the Gene
Ontology database.
*gpls*
Classification using generalized partial least squares for two-group
and multi-group classification.
*graph*
Classes and tools for creating and manipulating graphs within R.
*gtkWidgets*
Widgets built using *RGtk*.
*hexbin*
Binning functions, in particular hexagonal bins for graphing.
*hopach*
Hierarchical Ordered Partitioning and Collapsing Hybrid (HOPACH).
*hypergraph*
Capabilities for representing and manipulating hypergraphs.
*iSPlot*
Link views that are based on the same data set.
*idiogram*
Plotting genomic data by chromosomal location.
*impute*
Imputation for microarray data (currently KNN only).
*limma*
Linear models for microarray data.
*limmaGUI*
Graphical User Interface for package *limma*.
*logicFS*
Identification of SNP interactions.
*maCorrPlot*
Visualize artificial correlation in microarray data.
*maDB*
Microarray database and utility functions for microarray analysis.
*maSigPro*
Significant gene expression profile differeneces in time course
microarray data.
*maanova*
Tools for analyzing micro array experiments.
*macat*
MicroArray Chromosome Analysis Tool.
*made4*
Multivariate analysis of microarray data using ADE4.
*makecdfenv*
Two functions. One reads a Affymetrix chip description file (CDF) and
creates a hash table environment containing the location/probe set
membership mapping. The other creates a package that automatically
loads that environment.
*marray*
Exploratory analysis for two-color spotted microarray data.
*matchprobes*
Tools for sequence matching of probes on arrays.
*metaArray*
Integration of microarray data for meta-analysis.
*mmgmos*
Multi-chip Modified Gamma Model of Oligonucleotide Signal.
*multtest*
Multiple testing procedures for controlling the family-wise error rate
(FWER) and the false discovery rate (FDR). Tests can be based on t-
or F-statistics for one- and two-factor designs, and permutation
procedures are available to estimate adjusted p-values.
*nnNorm*
Spatial and intensity based normalization of cDNA microarray data based
on robust neural nets.
*nudge*
Normal Uniform Differential Gene Expression detection.
*ontoTools*
Graphs and sparse matrices for working with ontologies; formal objects
for nomenclatures with provenance management.
*pairseqsim*
Pairwise sequence alignment and scoring algorithms for global, local
and overlap alignment with affine gap penalty.
*pamr*
Pam: Prediction Analysis for Microarrays.
*panp*
Presence-Absence calls from Negative strand matching Probesets.
*pathRender*
Render molecular pathways.
*pdmclass*
CLASSification of microarray samples using Penalized Discriminant
Methods.
*pgUtils*
Utility functions for PostgreSQL databases.
*pickgene*
Adaptive gene picking for microarray expression data analysis.
*plgem*
Power Law Global Error Model.
*plier*
Implements the Affymetrix PLIER (Probe Logarithmic Error Intensity
Estimate) algorithm.
*prada*
Tools for analyzing and navigating data from high-throughput
phenotyping experiments based on cellular assays and fluorescent
detection.
*qtlvalue*
Q-value estimation for false discovery rate control.
*rama*
Robust Analysis of MicroArrays: robust estimation of cDNA microarray
intensities with replicates using a Bayesian hierarchical model.
*reb*
Regional Expression Biases.
*reposTools*
Tools for dealing with file repositories and allow users to easily
install, update, and distribute packages, vignettes, and other files.
*rfcdmin*
Data sets for RFlowCyt examples.
*rflowcyt*
Statistical tools and data structures for analytic flow cytometry.
*safe*
Significance Analysis of Function and Expression.
*sagenhaft*
Functions for reading and comparing SAGE (Serial Analysis of Gene
Expression) libraries.
*siggenes*
Identifying differentially expressed genes and estimating the False
Discovery Rate (FDR) with both the Significance Analysis of Microarrays
(SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
*simpleaffy*
Very simple high level analysis of Affymetrix data.
*simulatorAPMS*
Computationally simulates the AP-MS technology.
*sizepower*
Sample size and power calculation in microrarray studies.
*snapCGH*
Segmentation, normalization and processing of aCGH data.
*splicegear*
A set of tools to work with alternative splicing.
*spotSegmentation*
Microarray spot segmentation and gridding for blocks of microarray
spots.
*sscore*
S-score algorithm for Affymetrix oligonucleotide microarrays.
*ssize*
Estimate microarry sample size.
*stam*
STructured Analysis of Microarray data.
*stepNorm*
Stepwise normalization functions for cDNA microarrays.
*tilingArray*
Analysis of tiling arrays.
*timecourse*
Statistical analysis for developmental microarray time course data.
*tkWidgets*
Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
*twilight*
Estimation of local false discovery rate.
*vsn*
Calibration and variance stabilizing transformations for both
Affymetrix and cDNA array data.
*webbioc*
Integrated web interface for doing microarray analysis using several of
the Bioconductor packages.
*widgetInvoke*
Evaluation widgets for functions.
*widgetTools*
Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
interfaces.
*xcms*
LC/MS and GC/MS data analysis: framework for processing and
visualization of chromatographically separated mass spectral data.
*y2hStat*
Analysis of Yeast 2-Hybrid data sets.
5.1.5 Other add-on packages
---------------------------
Jim Lindsey <jlindsey@gen.unimaas.nl> has written a collection of R
packages for nonlinear regression and repeated measurements, consisting of
*event* (event history procedures and models), *gnlm* (generalized
nonlinear regression models), *growth* (multivariate normal and
elliptically-contoured repeated measurements models), *repeated*
(non-normal repeated measurements models), *rmutil* (utilities for
nonlinear regression and repeated measurements), and *stable* (probability
functions and generalized regression models for stable distributions). All
analyses in the new edition of his book "Models for Repeated Measurements"
(1999, Oxford University Press) were carried out using these packages. Jim
has also started *dna*, a package with procedures for the analysis of DNA
sequences. Jim's packages can be obtained from
`http://popgen.unimaas.nl/~jlindsey/rcode.html'.
More code has been posted to the R-help mailing list, and can be
obtained from the mailing list archive.
5.2 How can add-on packages be installed?
=========================================
(Unix only.) The add-on packages on CRAN come as gzipped tar files named
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
one package. Provided that `tar' and `gzip' are available on your system,
type
$ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
at the shell prompt to install to the library tree rooted at the first
directory given in `R_LIBS' (see below) if this is set and non-null, and to
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
(Versions of R prior to 1.3.0 installed to the default library by default.)
To install to another tree (e.g., your private one), use
$ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
where LIB gives the path to the library tree to install to.
Even more conveniently, you can install and automatically update
packages from within R if you have access to repositories such as CRAN.
See the help page for `available.packages()' for more information.
You can use several library trees of add-on packages. The easiest way
to tell R to use these is via the environment variable `R_LIBS' which
should be a colon-separated list of directories at which R library trees
are rooted. You do not have to specify the default tree in `R_LIBS'.
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
`/usr/local/lib/R-contrib', put
R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
into your (Bourne) shell profile or even preferably, add the line
R_LIBS="~/lib/R:/usr/local/lib/R-contrib"
your `~/.Renviron' file. (Note that no `export' statement is needed or
allowed in this file; see the on-line help for `Startup' for more
information.)
5.3 How can add-on packages be used?
====================================
To find out which additional packages are available on your system, type
library()
at the R prompt.
This produces something like
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
base The R Base package
boot Bootstrap R (S-Plus) Functions (Canty)
class Functions for Classification
cluster Functions for clustering (by Rousseeuw et al.)
datasets The R datasets Package
foreign Read data stored by Minitab, S, SAS, SPSS, Stata, ...
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 smoothness estimation and GAMMs by REML/PQ
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
You can "load" the installed package PKG by
library(PKG)
You can then find out which functions it provides by typing one of
library(help = PKG)
help(package = PKG)
You can unload the loaded package PKG by
detach("package:PKG")
5.4 How can add-on packages be removed?
=======================================
Use
$ R CMD REMOVE PKG_1 ... PKG_N
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
the first directory given in `R_LIBS' 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.)
To remove from library LIB, do
$ R CMD REMOVE -l LIB PKG_1 ... PKG_N
5.5 How can I create an R package?
==================================
A package consists of a subdirectory containing the files `DESCRIPTION' and
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
`src', and `tests' (some of which can be missing). Optionally the package
can also contain script files `configure' and `cleanup' which are executed
before and after installation.
See section "Creating R packages" in `Writing R Extensions', for
details. This manual is included in the R distribution, *note What
documentation exists for R?::, and gives information on package structure,
the configure and cleanup mechanisms, and on automated package checking and
building.
R version 1.3.0 has added the function `package.skeleton()' which will
set up directories, save data and code, and create skeleton help files for
a set of R functions and datasets.
*Note What is CRAN?::, for information on uploading a package to CRAN.
5.6 How can I contribute to R?
==============================
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.
One place where functionality is still missing is the modeling software
as described in "Statistical Models in S" (see *Note What is S?::); some of
the nonlinear modeling code is not there yet.
The R Developer Page (http://developer.R-project.org/) 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 CVS miscellanea.
Many (more) of the packages available at the Statlib S Repository might
be worth porting to R.
If you are interested in working on any of these projects, please notify
Kurt Hornik <Kurt.Hornik@R-project.org>.
6 R and Emacs
*************
6.1 Is there Emacs support for R?
=================================
There is an Emacs package called ESS ("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 S-PLUS 3.x/4.x/5.x/6.x/7.x), LispStat dialects
(XLispStat, ViSta), SAS, Stata, and BUGS.
ESS grew out of the need for bug fixes and extensions to S-mode 4.8
(which was a GNU Emacs interface to S/S-PLUS 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.
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 ESS 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).
The latest stable version of ESS are available via CRAN or the ESS web
page (http://ESS.R-project.org/). The HTML version of the documentation
can be found at `http://stat.ethz.ch/ESS/'.
ESS comes with detailed installation instructions.
For help with ESS, send email to <ESS-help@stat.math.ethz.ch>.
Please send bug reports and suggestions on ESS to
<ESS-bugs@stat.math.ethz.ch>. The easiest way to do this from is within
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
pulldown menus.
6.2 Should I run R from within Emacs?
=====================================
Yes, _definitely_. 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.
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.
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.
To specify command line arguments for the inferior R process, use `C-u
M-x R' for starting R.
6.3 Debugging R from within Emacs
=================================
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 `M-x gdb' and give the path to the R _binary_ as
argument. At the `gdb' prompt, set `R_HOME' and other environment
variables as needed (using e.g. `set env R_HOME /path/to/R/', but see also
below), and start the binary with the desired arguments (e.g., `run
--quiet').
If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
start an inferior R process with arguments `-d gdb'.
A third option is to start an inferior R process via ESS (`M-x R') and
then start GUD (`M-x gdb') giving the R binary (using its full path name)
as the program to debug. Use the program `ps' to find the process number
of the currently running R process then use the `attach' command in gdb to
attach it to that process. One advantage of this method is that you have
separate `*R*' and `*gud-gdb*' windows. Within the `*R*' window you have
all the ESS facilities, such as object-name completion, that we know and
love.
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 `.gdbinit' 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:
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
7 R Miscellanea
***************
7.1 How can I set components of a list to NULL?
===============================================
You can use
x[i] <- list(NULL)
to set component `i' of the list `x' to `NULL', similarly for named
components. Do not set `x[i]' or `x[[i]]' to `NULL', because this will
remove the corresponding component from the list.
For dropping the row names of a matrix `x', it may be easier to use
`rownames(x) <- NULL', similarly for column names.
7.2 How can I save my workspace?
================================
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
`.RData' in the R startup directory. (This is also what happens after
`q("yes")'.) Using `save.image(FILE)' one can save the image under a
different name.
7.3 How can I clean up my workspace?
====================================
To remove all objects in the currently active environment (typically
`.GlobalEnv'), you can do
rm(list = ls(all = TRUE))
(Without `all = TRUE', only the objects with names not starting with a `.'
are removed.)
7.4 How can I get eval() and D() to work?
=========================================
Strange things will happen if you use `eval(print(x), envir = e)' or
`D(x^2, "x")'. The first one will either tell you that "`x'" is not found,
or print the value of the wrong `x'. The other one will likely return zero
if `x' exists, and an error otherwise.
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
`"expression"' or `"call"') is then evaluated or differentiated. What you
(most likely) really want is obtained by "quoting" the first argument upon
surrounding it with `expression()'. For example,
R> D(expression(x^2), "x")
2 * x
Although this behavior may initially seem to be rather strange, 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
D2 <- function(e, n) D(D(e, n), n)
or
g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
g(a * b)
See the help page for `deriv()' for more examples.
7.5 Why do my matrices lose dimensions?
=======================================
When a matrix with a single row or column is created by a subscripting
operation, e.g., `row <- mat[2, ]', 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 is created
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
unnecessary dimension. After much discussion this has been determined to
be a _feature_.
To prevent this happening, add the option `drop = FALSE' to the
subscripting. For example,
rowmatrix <- mat[2, , drop = FALSE] # creates a row matrix
colmatrix <- mat[, 2, drop = FALSE] # creates a column matrix
a <- b[1, 1, 1, drop = FALSE] # creates a 1 x 1 x 1 array
The `drop = FALSE' option should be used defensively when programming.
For example, the statement
somerows <- mat[index, ]
will return a vector rather than a matrix if `index' happens to have length
1, causing errors later in the code. It should probably be rewritten as
somerows <- mat[index, , drop = FALSE]
7.6 How does autoloading work?
==============================
R has a special environment called `.AutoloadEnv'. Using `autoload(NAME,
PKG)', where NAME and PKG are strings giving the names of an object and the
package containing it, stores some information in this environment. When R
tries to evaluate NAME, it loads the corresponding package PKG and
reevaluates NAME in the new package's environment.
Using this mechanism makes R behave as if the package was loaded, but
does not occupy memory (yet).
See the help page for `autoload()' for a very nice example.
7.7 How should I set options?
=============================
The function `options()' allows setting and examining a variety of global
"options" which affect the way in which R computes and displays its
results. The variable `.Options' 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.
For example, given
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")
}
we obtain:
R> test1()
3 3.14
R> test2()
3 3.141593
What is really used is the _global_ value of `.Options', and using
`options(OPT = VAL)' correctly updates it. Local copies of `.Options',
either in `.GlobalEnv' or in a function environment (frame), are just
silently disregarded.
7.8 How do file names work in Windows?
======================================
As R uses C-style string handling, `\' is treated as an escape character,
so that for example one can enter a newline as `\n'. When you really need
a `\', you have to escape it with another `\'.
Thus, in filenames use something like `"c:\\data\\money.dat"'. You can
also replace `\' by `/' (`"c:/data/money.dat"').
7.9 Why does plotting give a color allocation error?
====================================================
On an X11 device, plotting sometimes, e.g., when running `demo("image")',
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.)
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 `-no-install' (to use the default colormap) or the `-install'
(to install a private colormap) option.
You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
than the default `"pseudo"'. See the help page for `X11()' for more
information.
7.10 How do I convert factors to numeric?
=========================================
It may happen that when reading numeric data into R (usually, when reading
in a file), they come in as factors. If `f' is such a factor object, you
can use
as.numeric(as.character(f))
to get the numbers back. More efficient, but harder to remember, is
as.numeric(levels(f))[as.integer(f)]
In any case, do not call `as.numeric()' or their likes directly for the
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
7.11 Are Trellis displays implemented in R?
===========================================
The recommended package *lattice* (which is based on another recommended
package, *grid*) provides graphical functionality that is compatible with
most Trellis commands.
You could also look at `coplot()' and `dotchart()' which might do at
least some of what you want. Note also that the R version of `pairs()' is
fairly general and provides most of the functionality of `splom()', and
that R's default plot method has an argument `asp' allowing to specify (and
fix against device resizing) the aspect ratio of the plot.
(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.)
7.12 What are the enclosing and parent environments?
====================================================
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").
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
`f()' inside another function `g()' its enclosing environment is the
environment inside `g()'. The enclosing environment for a function is
fixed when the function is created. You can find out the enclosing
environment for a function `f()' using `environment(f)'.
The "parent" environment, on the other hand, is defined when you invoke
a function. If you invoke `lm()' at the command line its parent
environment is the global workspace, if you invoke it inside a function
`f()' then its parent environment is the environment inside `f()'. You can
find out the parent environment for an invocation of a function by using
`parent.frame()' or `sys.frame(sys.parent())'.
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 `f()' is defined inside another function `g()' it will
probably be used inside `g()' as well, so its parent environment and
enclosing environment will probably be the same.
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.
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.)
Scoping _is_ 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 _always_ the global
workspace, but in R the enclosing environment is wherever the function was
created.
7.13 How can I substitute into a plot label?
============================================
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 `paste()' 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 `parse()' on your pasted character string or use `substitute()' on an
expression. For example, if `ahat' is an estimator of your parameter a of
interest, use
title(substitute(hat(a) == ahat, list(ahat = ahat)))
(note that it is `==' and not `='). Sometimes `bquote()' gives a more
compact form, e.g.,
title(bquote(hat(a) = .(ahat)))
where subexpressions enclosed in `.()' are replaced by their values.
There are more worked examples in the mailing list achives.
7.14 What are valid names?
==========================
When creating data frames using `data.frame()' or `read.table()', R by
default ensures that the variable names are syntactically valid. (The
argument `check.names' to these functions controls whether variable names
are checked and adjusted by `make.names()' if needed.)
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:
1. A _syntactic name_ is a string the parser interprets as this type of
expression. It consists of letters, numbers, and the dot and (for
version 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.
2. An _object name_ 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 `assign()'
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 `assign()').
3. An _argument name_ is what appears to the left of the equals sign when
supplying an argument in a function call (for example, `f(trim=.5)').
Argument names are also usually syntactic names, but again can be
anything if they are quoted.
4. An _element name_ 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 `$' 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 `eval()' or `attach()', the element names
become object names.)
5. Finally, a _file name_ 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".
7.15 Are GAMs implemented in R?
===============================
Package *gam* from CRAN 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 `gam()' function for GAMs
in package *mgcv*, but it is not an exact clone of what is described in the
White Book (no `lo()' for example). Package *gss* can fit spline-based
GAMs too. And if you can accept regression splines you can use `glm()'.
For gaussian GAMs you can use `bruto()' from package *mda*.
7.16 Why is the output not printed when I source() a file?
==========================================================
Most R commands do not generate any output. The command
1+1
computes the value 2 and returns it; the command
summary(glm(y~x+z, family=binomial))
fits a logistic regression model, computes some summary information and
returns an object of class `"summary.glm"' (*note How should I write
summary methods?::).
If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
command line the returned value is automatically printed (unless it is
`invisible()'), but in other circumstances, such as in a `source()'d file
or inside a function it isn't printed unless you specifically print it.
To print the value use
print(1+1)
or
print(summary(glm(y~x+z, family=binomial)))
instead, or use `source(FILE, echo=TRUE)'.
7.17 Why does outer() behave strangely with my function?
========================================================
As the help for `outer()' indicates, it does not work on arbitrary
functions the way the `apply()' family does. It requires functions that
are vectorized to work elementwise on arrays. As you can see by looking at
the code, `outer(x, y, FUN)' creates two large vectors containing every
possible combination of elements of `x' and `y' and then passes this to
`FUN' all at once. Your function probably cannot handle two large vectors
as parameters.
If you have a function that cannot handle two vectors but can handle two
scalars, then you can still use `outer()' but you will need to wrap your
function up first, to simulate vectorized behavior. Suppose your function
is
foo <- function(x, y, happy) {
stopifnot(length(x) == 1, length(y) == 1) # scalars only!
(x + y) * happy
}
If you define the general function
wrapper <- function(x, y, my.fun, ...) {
sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
}
then you can use `outer()' by writing, e.g.,
outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
7.18 Why does the output from anova() depend on the order of factors in the model?
==================================================================================
In a model such as `~A+B+A:B', R will report the difference in sums of
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'. If the model
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
and `~A', in the second case it is comparing `~B' and `~B+A'. In a
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
(conceptually and numerically) different.
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.
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 `anova(MODEL1, MODEL2)', and
`drop1(MODEL1)' will show the sums of squares resulting from dropping
single terms.
7.19 How do I produce PNG graphics in batch mode?
=================================================
Under Unix, the `png()' device uses the X11 driver, which is a problem in
batch mode or for remote operation. If you have Ghostscript you can use
`bitmap()', which produces a PostScript file then converts it to any bitmap
format supported by Ghostscript. On some installations this produces ugly
output, on others it is perfectly satisfactory. In theory one could also
use Xvfb from X.Org (http://www.x.org/Downloads.html), which is an X11
server that does not require a screen; and the *GDD* package from CRAN,
which produces PNG, JPEG and GIF bitmaps without X11.
7.20 How can I get command line editing to work?
================================================
The Unix 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 GNU 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 `libreadline-dev'
(Debian) or `readline-devel' (Red Hat).
7.21 How can I turn a string into a variable?
=============================================
If you have
varname <- c("a", "b", "d")
you can do
get(varname[1]) + 2
for
a + 2
or
assign(varname[1], 2 + 2)
for
a <- 2 + 2
or
eval(substitute(lm(y ~ x + variable),
list(variable = as.name(varname[1]))
for
lm(y ~ x + a)
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
vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
vars[["a"]]
without any of this messing about.
7.22 Why do lattice/trellis graphics not work?
==============================================
The most likely reason is that you forgot to tell R to display the graph.
Lattice functions such as `xyplot()' create a graph object, but do not
display it (the same is true of Trellis graphics in S-PLUS). The `print()'
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 `source()' or inside your own functions you
will need an explicit `print()' statement.
7.23 How can I sort the rows of a data frame?
=============================================
To sort the rows within a data frame, with respect to the values in one or
more of the columns, simply use `order()'.
7.24 Why does the help.start() search engine not work?
======================================================
The browser-based search engine in `help.start()' 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 _and_
JavaScript need to be enabled in your browser.
There have been a number of compatibility issues with versions of Java
and of browsers. For further details please consult section "Enabling
search in HTML help" in `R Installation and Administration'. This manual is
included in the R distribution, *note What documentation exists for R?::,
and its HTML version is linked from the HTML search page.
7.25 Why did my .Rprofile stop working when I updated R?
========================================================
Did you read the `NEWS' file? For functions that are not in the *base*
package you need to specify the correct package namespace, since the code
will be run _before_ the packages are loaded. E.g.,
ps.options(horizontal = FALSE)
help.start()
needs to be
grDevices::ps.options(horizontal = FALSE)
utils::help.start()
(`graphics::ps.options(horizontal = FALSE)' in R 1.9.x).
7.26 Where have all the methods gone?
=====================================
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.
To see the code for an S3 method (e.g., `[.terms') use
getS3method("[", "terms")
To see the code for an unexported function `foo()' in the namespace of
package `"bar"' use `bar:::foo'. 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.
7.27 How can I create rotated axis labels?
==========================================
To rotate axis labels (using base graphics), you need to use `text()',
rather than `mtext()', as the latter does not support `par("srt")'.
## Increase bottom margin to make room for rotated labels
par(mar = c(7, 4, 4, 2) + 0.1)
## Create plot with no x axis and no x axis label
plot(1 : 8, xaxt = "n", xlab = "")
## Set up x axis with tick marks alone
axis(1, labels = FALSE)
## Create some text labels
labels <- paste("Label", 1:8, sep = " ")
## Plot x axis labels at default tick marks
text(1:8, par("usr")[3] - 0.25, srt = 45, adj = 1,
labels = labels, xpd = TRUE)
## Plot x axis label at line 6 (of 7)
mtext(1, text = "X Axis Label", line = 6)
When plotting the x axis labels, we use `srt = 45' for text rotation angle,
`adj = 1' to place the right end of text at the tick marks, and `xpd =
TRUE' to allow for text outside the plot region. You can adjust the value
of the `0.25' offset as required to move the axis labels up or down
relative to the x axis. See `?par' for more information.
Also see Figure 1 and associated code in Paul Murrell (2003),
"Integrating grid Graphics Output with Base Graphics Output", _R News_,
*3/2*, 7-12.
7.28 Why is read.table() so inefficient?
========================================
By default, `read.table()' 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 condiderable amounts of time and
memory. Performance can substantially be improved by using the
`colClasses' argument to specify the classes to be assumed for the columns
of the table.
7.29 What is the difference between package and library?
========================================================
A "package" is a standardized collection of material extending R, e.g.
providing code, data, or documentation. A "library" is a place (directory)
where R knows to find packages it can use (i.e., which were "installed").
R is told to use a package (to "load" it and add it to the search path) via
calls to the function `library'. I.e., `library()' is employed to load a
package from libraries containing packages.
*Note R Add-On Packages::, for more details. See also Uwe Ligges (2003),
"R Help Desk: Package Management", _R News_, *3/3*, 37-39.
7.30 I installed a package but the functions are not there
==========================================================
To actually _use_ the package, it needs to be _loaded_ using `library()'.
See *Note R Add-On Packages:: and *Note What is the difference between
package and library?:: for more information.
7.31 Why doesn't R think these numbers are equal?
=================================================
The only numbers that can be represented exactly in R's numeric type are
integers and fractions whose denominator is a power of 2. Other numbers
have to be 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
R> a <- sqrt(2)
R> a * a == 2
[1] FALSE
R> a * a - 2
[1] 4.440892e-16
The function `all.equal()' compares two objects using a numeric
tolerance of `.Machine$double.eps ^ 0.5'. If you want much greater
accuracy than this you will need to consider error propagation carefully.
For more information, see e.g. David Goldberg (1991), "What Every
Computer Scientist Should Know About Floating-Point Arithmetic", _ACM
Computing Surveys_, *23/1*, 5-48, also available via
`http://docs.sun.com/source/806-3568/ncg_goldberg.html'.
7.32 How can I capture or ignore errors in a long simulation?
=============================================================
Use `try()', which returns an object of class `"try-error"' instead of an
error, or preferably `tryCatch()', where the return value can be configured
more flexibly. For example
beta[i,] <- tryCatch(coef(lm(formula, data)),
error = function(e) rep(NaN, 4))
would return the coefficients if the `lm()' call succeeded and would return
`c(NaN, NaN, NaN, NaN)' if it failed (presumably there are supposed to be 4
coefficients in this example).
7.33 Why are powers of negative numbers wrong?
==============================================
You are probably seeing something like
R> -2^2
[1] -4
and misunderstanding the precedence rules for expressions in R. Write
R> (-2)^2
[1] 4
to get the square of -2.
The precedence rules are documented in `?Syntax', and to see how R
interprets an expression you can look at the parse tree
R> as.list(quote(-2^2))
[[1]]
`-`
[[2]]
2^2
7.34 How can I save the result of each iteration in a loop into a separate file?
================================================================================
One way is to use `paste()' (or `sprintf()') to concatenate a stem filename
and the iteration number while `file.path()' constructs the path. For
example, to save results into files `result1.rda', ..., `result100.rda' in
the subdirectory `Results' of the current working directory, one can use
for(i in 1:100) {
## Calculations constructing "some_object" ...
fp <- file.path("Results", paste("result", i, ".rda", sep = ""))
save(list = "some_object", file = fp)
}
7.35 Why are p-values not displayed when using lmer()?
======================================================
Doug Bates has kindly provided an extensive response in a post to the
r-help list, which can be reviewed at
`https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html'.
7.36 Why are there unwanted lines between polygons in PDF output viewed in Adobe Reader?
========================================================================================
Output from `polygon()' (and other functions calling `polygon()') with the
argument `border=NA' or `border="transparent"' should suppress border lines
between polygons for all graphics devices.
PDF output from R can be made in many ways, both directly, and through
for example Postscript or Windows Metafiles converted to PDF in external
software. In Adobe Reader, the default setting for line art, such as
polygons, is to smooth, which produces the impression of thin borders.
Adobe Reader does this both for PDF files written by R or through other
software.
This is irritating, especially when using Adobe Reader for presentation.
The unwanted effect can be removed by turning off smoothing for line art:
use the `Edit | Preferences | Page Display | Smooth line art' menu in Adobe
Reader 7.0.
7.37 Why does backslash behave strangely inside strings?
========================================================
This question most often comes up in relation to file names (see *Note How
do file names work in Windows?::) but it also happens that people complain
that they cannot seem to put a single `\' character into a text string
unless it happens to be followed by certain other characters.
To understand this, you have to distinguish between character strings
and _representations_ 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 contains the quote character. So
> str <- "This \"text\" is quoted"
> str
[1] "This \"text\" is quoted"
> cat(str, "\n")
This "text" is quoted
The _escape sequences_ `\"' and `\n' represent a double quote and the
newline character respectively. Printing text strings, using `print()' or
by typing the name at the prompt will use the escape sequences too, but the
`cat()' function will display the string as-is. Notice that `"\n"' is a
one-character string, not two; the backslash is not actually in the string,
it is just generated in the printed representation.
> nchar("\n")
[1] 1
> substring("\n", 1, 1)
[1] "\n"
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
> cat("\\n", "\n")
\n
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 _quadruple_
backslash to represent a single literal one.
In current versions of R (up to 2.4.0) an unknown escape sequence like
`\p' is quietly interpreted as just `p'. The development version now emits
a warning.
8 R Programming
***************
8.1 How should I write summary methods?
=======================================
Suppose you want to provide a summary method for class `"foo"'. Then
`summary.foo()' should not print anything, but return an object of class
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
which nicely prints the summary information and invisibly returns its
object. This approach is preferred over having `summary.foo()' print
summary information and return something useful, as sometimes you need to
grab something computed by `summary()' inside a function or similar. In
such cases you don't want anything printed.
8.2 How can I debug dynamically loaded code?
============================================
Roughly speaking, you need to start R inside the debugger, load the code,
send an interrupt, and then set the required breakpoints.
See section "Finding entry points in dynamically loaded code" in
`Writing R Extensions'. This manual is included in the R distribution,
*note What documentation exists for R?::.
8.3 How can I inspect R objects when debugging?
===============================================
The most convenient way is to call `R_PV' from the symbolic debugger.
See section "Inspecting R objects when debugging" in `Writing R
Extensions'.
8.4 How can I change compilation flags?
=======================================
Suppose you have C code file for dynloading into R, but you want to use `R
CMD SHLIB' with compilation flags other than the default ones (which were
determined when R was built).
Starting with R 2.1.0, users can provide personal Makevars configuration
files in `$`HOME'/.R' to override the default flags. See section "Add-on
packages" in `R Installation and Administration'.
For earlier versions of R, you could change the file
`$`R_HOME'/etc/Makeconf' to reflect your preferences, or (at least for
systems using GNU Make) override them by the environment variable
`MAKEFLAGS'. See section "Creating shared objects" in `Writing R
Extensions'.
8.5 How can I debug S4 methods?
===============================
Use the `trace()' function with argument `signature=' to add calls to the
browser or any other code to the method that will be dispatched for the
corresponding signature. See `?trace' for details.
9 R Bugs
********
9.1 What is a bug?
==================
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
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
yourself (or in a function you wrote), you can always crash R by using
wrong argument types (modes). This is not a bug.
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 _know_ 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.
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. Rather than jumping to
conclusions, show the problem to someone who knows for certain.
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.
If the online argument list of a function disagrees with the manual, one
of them must be wrong, so report the bug.
9.2 How to report a bug
=======================
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 `version' in R to
print this.
The most important principle in reporting a bug is to report _facts_,
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.
For example, suppose that on a data set which you know to be quite large
the command
R> data.frame(x, y, z, monday, tuesday)
never returns. Do not report that `data.frame()' 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
`data.frame()' 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.
Or perhaps the command fails because the last command you used was a
method for `"["()' that had a bug causing R's internal data structures to
be corrupted and making the `data.frame()' command fail from then on. This
is why others need to know what other commands you have typed (or read from
your startup file).
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 the problem, preferably the
simplest one you have found.
Invoking R with the `--vanilla' option may help in isolating a bug.
This ensures that the site profile and saved data files are not read.
Before you actually submit a bug report, you should check whether the
bug has already been reported and/or fixed. First, try the "Search
Existing Reports" facility in the Bug Tracking page at
`http://bugs.R-project.org/'. Second, consult
`https://svn.R-project.org/R/trunk/NEWS', which records changes that will
appear in the _next_ release of R, including some bug fixes that do not
appear in Bug Tracking. (Windows users should additionally consult
`https://svn.R-project.org/R/trunk/src/gnuwin32/CHANGES'.) 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.
On Unix systems a bug report can be generated using the function
`bug.report()'. This automatically includes the version information and
sends the bug to the correct address. Alternatively the bug report can be
emailed to <R-bugs@R-project.org> or submitted to the Web page at
`http://bugs.R-project.org/'. Please try including results of
`sessionInfo()' in your bug report.
There is a section of the bug repository for suggestions for
enhancements for R labelled `wishlist'. 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 `Wishlist:'.
Comments on and suggestions for the Windows port of R should be sent to
<R-windows@R-project.org>.
Corrections to and comments on message translation should be sent to the
last translator (listed at the top of the appropriate `.po' file) or to the
translation team as listed at
`http://developer.R-project.org/TranslationTeams.html'.
10 Acknowledgments
******************
Of course, many many thanks to Robert and Ross for the R system, and to the
package writers and porters for adding to it.
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 FAQ.
More to come soon ...
|