R version 3.2.3 RC (2015-12-08 r69745) -- "Wooden Christmas-Tree" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## These are tests that require internet functionality, and > ## a working Internet connection. > ## We attempt to test for those. > > if(!capabilities()["http/ftp"]) { + warning("no internet capabilities") + q() + } > > if(.Platform$OS.type == "unix" && + is.null(nsl("cran.r-project.org"))) q() > > # test do_download. > nrow(available.packages(contrib.url("http://cran.r-project.org"))) [1] 7588 > > # test url connections on http > zz <- url("http://cran.r-project.org/") > readLines(zz) [1] "" [2] "" [3] "" [4] "The Comprehensive R Archive Network" [5] "" [6] "" [7] "" [8] "" [9] "" [10] "" [11] "" [12] "" [13] "" [14] "" [15] "" [16] "" [17] "" [18] "<h1>The Comprehensive R Archive Network</h1>" [19] "" [20] "Your browser seems not to support frames," [21] "here is the <A href=\"navbar.html\">contents page</A> of CRAN." [22] "" [23] "" > close(zz) > > # and via read.table, test http and ftp. > > read.table("http://www.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat") V1 V2 V3 V4 V5 1 1 307 930 36.58 0 2 2 307 940 36.73 0 3 3 307 950 36.93 0 4 4 307 1000 37.15 0 5 5 307 1010 37.23 0 6 6 307 1020 37.24 0 7 7 307 1030 37.24 0 8 8 307 1040 36.90 0 9 9 307 1050 36.95 0 10 10 307 1100 36.89 0 11 11 307 1110 36.95 0 12 12 307 1120 37.00 0 13 13 307 1130 36.90 0 14 14 307 1140 36.99 0 15 15 307 1150 36.99 0 16 16 307 1200 37.01 0 17 17 307 1210 37.04 0 18 18 307 1220 37.04 0 19 19 307 1230 37.14 0 20 20 307 1240 37.07 0 21 21 307 1250 36.98 0 22 22 307 1300 37.01 0 23 23 307 1310 36.97 0 24 24 307 1320 36.97 0 25 25 307 1330 37.12 0 26 26 307 1340 37.13 0 27 27 307 1350 37.14 0 28 28 307 1400 37.15 0 29 29 307 1410 37.17 0 30 30 307 1420 37.12 0 31 31 307 1430 37.12 0 32 32 307 1440 37.17 0 33 33 307 1450 37.28 0 34 34 307 1500 37.28 0 35 35 307 1510 37.44 0 36 36 307 1520 37.51 0 37 37 307 1530 37.64 0 38 38 307 1540 37.51 0 39 39 307 1550 37.98 1 40 40 307 1600 38.02 1 41 41 307 1610 38.00 1 42 42 307 1620 38.24 1 43 43 307 1630 38.10 1 44 44 307 1640 38.24 1 45 45 307 1650 38.11 1 46 46 307 1700 38.02 1 47 47 307 1710 38.11 1 48 48 307 1720 38.01 1 49 49 307 1730 37.91 1 50 50 307 1740 37.96 1 51 51 307 1750 38.03 1 52 52 307 1800 38.17 1 53 53 307 1810 38.19 1 54 54 307 1820 38.18 1 55 55 307 1830 38.15 1 56 56 307 1840 38.04 1 57 57 307 1850 37.96 1 58 58 307 1900 37.84 1 59 59 307 1910 37.83 1 60 60 307 1920 37.84 1 61 61 307 1930 37.74 1 62 62 307 1940 37.76 1 63 63 307 1950 37.76 1 64 64 307 2000 37.64 1 65 65 307 2010 37.63 1 66 66 307 2020 38.06 1 67 67 307 2030 38.19 1 68 68 307 2040 38.35 1 69 69 307 2050 38.25 1 70 70 307 2100 37.86 1 71 71 307 2110 37.95 1 72 72 307 2120 37.95 1 73 73 307 2130 37.76 1 74 74 307 2140 37.60 1 75 75 307 2150 37.89 1 76 76 307 2200 37.86 1 77 77 307 2210 37.71 1 78 78 307 2220 37.78 1 79 79 307 2230 37.82 1 80 80 307 2240 37.76 1 81 81 307 2250 37.81 1 82 82 307 2300 37.84 1 83 83 307 2310 38.01 1 84 84 307 2320 38.10 1 85 85 307 2330 38.15 1 86 86 307 2340 37.92 1 87 87 307 2350 37.64 1 88 88 308 0 37.70 1 89 89 308 10 37.46 1 90 90 308 20 37.41 1 91 91 308 30 37.46 1 92 92 308 40 37.56 1 93 93 308 50 37.55 1 94 94 308 100 37.75 1 95 95 308 110 37.76 1 96 96 308 120 37.73 1 97 97 308 130 37.77 1 98 98 308 140 38.01 1 99 99 308 150 38.04 1 100 100 308 200 38.07 1 > read.table("ftp://ftp.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat") V1 V2 V3 V4 V5 1 1 307 930 36.58 0 2 2 307 940 36.73 0 3 3 307 950 36.93 0 4 4 307 1000 37.15 0 5 5 307 1010 37.23 0 6 6 307 1020 37.24 0 7 7 307 1030 37.24 0 8 8 307 1040 36.90 0 9 9 307 1050 36.95 0 10 10 307 1100 36.89 0 11 11 307 1110 36.95 0 12 12 307 1120 37.00 0 13 13 307 1130 36.90 0 14 14 307 1140 36.99 0 15 15 307 1150 36.99 0 16 16 307 1200 37.01 0 17 17 307 1210 37.04 0 18 18 307 1220 37.04 0 19 19 307 1230 37.14 0 20 20 307 1240 37.07 0 21 21 307 1250 36.98 0 22 22 307 1300 37.01 0 23 23 307 1310 36.97 0 24 24 307 1320 36.97 0 25 25 307 1330 37.12 0 26 26 307 1340 37.13 0 27 27 307 1350 37.14 0 28 28 307 1400 37.15 0 29 29 307 1410 37.17 0 30 30 307 1420 37.12 0 31 31 307 1430 37.12 0 32 32 307 1440 37.17 0 33 33 307 1450 37.28 0 34 34 307 1500 37.28 0 35 35 307 1510 37.44 0 36 36 307 1520 37.51 0 37 37 307 1530 37.64 0 38 38 307 1540 37.51 0 39 39 307 1550 37.98 1 40 40 307 1600 38.02 1 41 41 307 1610 38.00 1 42 42 307 1620 38.24 1 43 43 307 1630 38.10 1 44 44 307 1640 38.24 1 45 45 307 1650 38.11 1 46 46 307 1700 38.02 1 47 47 307 1710 38.11 1 48 48 307 1720 38.01 1 49 49 307 1730 37.91 1 50 50 307 1740 37.96 1 51 51 307 1750 38.03 1 52 52 307 1800 38.17 1 53 53 307 1810 38.19 1 54 54 307 1820 38.18 1 55 55 307 1830 38.15 1 56 56 307 1840 38.04 1 57 57 307 1850 37.96 1 58 58 307 1900 37.84 1 59 59 307 1910 37.83 1 60 60 307 1920 37.84 1 61 61 307 1930 37.74 1 62 62 307 1940 37.76 1 63 63 307 1950 37.76 1 64 64 307 2000 37.64 1 65 65 307 2010 37.63 1 66 66 307 2020 38.06 1 67 67 307 2030 38.19 1 68 68 307 2040 38.35 1 69 69 307 2050 38.25 1 70 70 307 2100 37.86 1 71 71 307 2110 37.95 1 72 72 307 2120 37.95 1 73 73 307 2130 37.76 1 74 74 307 2140 37.60 1 75 75 307 2150 37.89 1 76 76 307 2200 37.86 1 77 77 307 2210 37.71 1 78 78 307 2220 37.78 1 79 79 307 2230 37.82 1 80 80 307 2240 37.76 1 81 81 307 2250 37.81 1 82 82 307 2300 37.84 1 83 83 307 2310 38.01 1 84 84 307 2320 38.10 1 85 85 307 2330 38.15 1 86 86 307 2340 37.92 1 87 87 307 2350 37.64 1 88 88 308 0 37.70 1 89 89 308 10 37.46 1 90 90 308 20 37.41 1 91 91 308 30 37.46 1 92 92 308 40 37.56 1 93 93 308 50 37.55 1 94 94 308 100 37.75 1 95 95 308 110 37.76 1 96 96 308 120 37.73 1 97 97 308 130 37.77 1 98 98 308 140 38.01 1 99 99 308 150 38.04 1 100 100 308 200 38.07 1 >