1 |
x |
|
op |
|
VL |
|
xlab |
|
ylab |
|
frame.plot |
|
plotit |
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 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, op = TRUE, VL = FALSE, xlab = "X", ylab = "Rel. Freq.",
frame.plot = TRUE, plotit = TRUE)
{
x <- x[!is.na(x)]
temp <- sort(unique(x))
freq <- NA
for (i in 1:length(temp)) {
freq[i] <- sum(x == temp[i])
}
rmfreq = freq
nval = sum(freq)
freq <- freq/length(x)
tfreq <- freq
tfreq[1] <- 0
tfreq[2] <- max(freq)
if (plotit) {
plot(temp, tfreq, xlab = xlab, ylab = ylab, type = "n",
frame.plot = frame.plot)
points(temp, freq, pch = "*")
if (op)
if (!VL)
lines(temp, freq)
if (VL) {
for (i in 1:length(temp)) lines(c(temp[i], temp[i]),
c(0, freq[i]))
}
}
list(n = nval, frequencies = rmfreq)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.