-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathcranometer.Rd
More file actions
99 lines (88 loc) · 2.91 KB
/
Copy pathcranometer.Rd
File metadata and controls
99 lines (88 loc) · 2.91 KB
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
% Generated by roxygen2 (4.0.2): do not edit by hand
\name{cranometer}
\alias{cranometer}
\title{Measures the speed of downloading from different CRAN mirrors}
\source{
\url{https://stat.ethz.ch/pipermail/r-help/2009-July/206430.html}
}
\usage{
cranometer(ms = getCRANmirrors(all = FALSE, local.only = FALSE), ...)
}
\arguments{
\item{ms}{- the output of getCRANmirrors. Defaults to
using all of the mirrors.}
\item{...}{not in use}
}
\value{
a data.frame with details on mirror sites and the time it
took to download their NEWS file.
}
\description{
Estimates the speed of each CRAN mirror by measuring the
time it takes to download the NEWS file.
}
\details{
It works by downloading the latest NEWS file (288 Kbytes at
the moment, so not huge) from each of the mirror sites in
the CRAN mirrors list. If you want to test it on a subset
then call getCRANmirrors yourself and subset it somehow.
It runs on the full CRAN list and while desiginig this
package I've yet to find a timeout or error so I'm not sure
what will happen if download.file fails. It retuns a data
frame like you get from getCRANmirrors but with an extra
't' column giving the elapsed time to get the NEWS file.
CAVEATS: if your network has any local caching then these
results will be wrong, since your computer will probably be
getting the locally cached NEWS file and not the one on the
server. Especially if you run it twice. Oh, I should have
put cacheOK=FALSE in the download.file - but even that
might get overruled somewhere. Also, sites may have good
days and bad days, good minutes and bad minutes, your
network may be congested on a short-term basis, etc etc.
There may also be a difference in reliability, which would
not so easily be measured by an individual user.
Later that year, Barry also wrote Cranography. See:
\url{https://stat.ethz.ch/pipermail/r-help/2009-July/206489.html},
\url{http://www.maths.lancs.ac.uk/~rowlings/R/Cranography/}.
}
\examples{
\dontrun{
# this can take some time
x <- cranometer()
time_order <- order(x$t)
# a quick overview of the fastest mirrors
head(x[time_order,c(1:4, 9)], 20)
# a dotchart of the fastest mirrors
with(x[rev(time_order),],
dotchart(t, labels =Name,
cex = .5, xlab = "Timing of CRAN mirror")
)
# tail(geonames_df)
# tail(x)
require(plyr)
ss <- !(x$Name == "0-Cloud")
gvis_df <- ddply(x[ss,], .(CountryCode), function(xx) {
ss <- which.min(xx$t)
if(length(ss) == 0) ss <- 1
data.frame(time = xx$t[ss], name = xx$Name[ss] )
})
gvis_df <- gvis_df[!is.na(gvis_df$time), ]
require2("googleVis")
Geo<-gvisGeoMap(gvis_df,
locationvar = "CountryCode",
numvar="time",
hovervar = "name",
options=list(
colors='[0xA5EF63,
0xFFB581, 0xFF8747]')
)
# Display chart
plot(Geo)
}
}
\author{
Barry Rowlingson <b.rowlingson@lancaster.ac.uk>
}
\seealso{
\link{freegeoip}, \link{myip}, \link{cranometer}
}