Arith
"+"
, "-"
, "*"
, "^"
,
"%%"
, "%/%"
, "/"
Compare
"=="
, ">"
, "<"< code="">, "!="
,
"<="< code="">, ">="
Logic
"&"
, "|"
Ops
"Arith"
, "Compare"
, "Logic"
Math
"abs"
, "sign"
, "sqrt"
,
"ceiling"
, "floor"
, "trunc"
, "cummax"
,
"cummin"
, "cumprod"
, "cumsum"
, "log"
,
"log10"
, "log2"
, "log1p"
, "acos"
,
"acosh"
, "asin"
, "asinh"
, "atan"
,
"atanh"
, "exp"
, "expm1"
, "cos"
,
"cosh"
, "sin"
, "sinh"
, "tan"
, "tanh"
,
"gamma"
, "lgamma"
, "digamma"
, "trigamma"
Math2
"round"
, "signif"
Summary
"max"
, "min"
, "range"
,
"prod"
, "sum"
, "any"
, "all"
Complex
"Arg"
, "Conj"
, "Im"
,
"Mod"
, "Re"
x
is an Rle object: summary(object, ..., digits = max(3, getOption("digits") - 3))
:
Summarizes the Rle object using an atomic vector convention. The
digits
argument is used for number formatting with
signif()
.
x
is an Rle object: !x
:
Returns logical negation (NOT) of x
.
which(x)
:
Returns an integer vector representing the TRUE
indices of
x
.
x
is an Rle object: diff(x, lag = 1, differences = 1
:
Returns suitably lagged and iterated differences of x
.
lag
differences
pmax(..., na.rm = FALSE)
, pmax.int(..., na.rm = FALSE)
:
Parallel maxima of the Rle input values. Removes NA
s when
na.rm = TRUE
.
pmin(..., na.rm = FALSE)
, pmin.int(..., na.rm = FALSE)
:
Parallel minima of the Rle input values. Removes NA
s when
na.rm = TRUE
.
which.max(x)
: Returns the index of the first element matching
the maximum value of x
.
mean(x, na.rm = FALSE)
:
Calculates the mean of x
. Removes NA
s when
na.rm = TRUE
.
var(x, y = NULL, na.rm = FALSE)
:
Calculates the variance of x
or covariance of x
and y
if both are supplied. Removes NA
s when na.rm = TRUE
.
cov(x, y, use = "everything")
, cor(x, y, use = "everything")
:
Calculates the covariance and correlation respectively of Rle objects
x
and y
.
The use
argument is an optional character string giving a method for
computing covariances in the presence of missing values. This must be
(an abbreviation of) one of the strings "everything"
,
"all.obs"
, "complete.obs"
, "na.or.complete"
, or
"pairwise.complete.obs"
.
sd(x, na.rm = FALSE)
:
Calculates the standard deviation of x
. Removes NA
s
when na.rm = TRUE
.
median(x, na.rm = FALSE)
:
Calculates the median of x
. Removes NA
s when
na.rm = TRUE
.
quantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7, ...)
:
Calculates the specified quantiles of x
.
probs
na.rm
TRUE
, removes NA
s from x
before the quantiles are computed.names
TRUE
, the result has names describing the
quantiles.type
quantile
.mad(x, center = median(x), constant = 1.4826, na.rm = FALSE, low = FALSE, high = FALSE)
:
Calculates the median absolute deviation of x
.
center
constant
na.rm
TRUE
, removes NA
s from x
before the mad is computed.low
TRUE
, compute the 'lo-median'.high
TRUE
, compute the 'hi-median'.IQR(x, na.rm = FALSE)
:
Calculates the interquartile range of x
.
na.rm
TRUE
, removes NA
s from x
before the IQR is computed.smoothEnds(y, k = 3)
:
Smooth end points of an Rle y
using subsequently smaller
medians and Tukey's end point rule at the very end.
k
x
is an Rle object: nchar(x, type = "chars", allowNA = FALSE)
:
Returns an integer Rle representing the number of characters in the
corresponding values of x
.
type
c("bytes", "chars", "width")
.allowNA
NA
be returned for invalid multibyte
strings rather than throwing an error?substr(x, start, stop)
, substring(text, first, last = 1000000L)
:
Returns a character or factor Rle containing the specified substrings
beginning at start
/first
and ending at
stop
/last
.
chartr(old, new, x)
:
Returns a character or factor Rle containing a translated version of
x
.
old
new
tolower(x)
:
Returns a character or factor Rle containing a lower case version of
x
.
toupper(x)
:
Returns a character or factor Rle containing an upper case version of
x
.
sub(pattern, replacement, x, ignore.case = FALSE,
perl = FALSE, fixed = FALSE, useBytes = FALSE)
:
Returns a character or factor Rle containing replacements based on
matches determined by regular expression matching. See sub
for a description of the arguments.
gsub(pattern, replacement, x, ignore.case = FALSE,
perl = FALSE, fixed = FALSE, useBytes = FALSE)
:
Returns a character or factor Rle containing replacements based on
matches determined by regular expression matching. See gsub
for a description of the arguments.
paste(..., sep = " ", collapse = NULL)
:
Returns a character or factor Rle containing a concatenation of
the values in ...
.
x
is an Rle object: levels(x)
, levels(x) <- value
:
Gets and sets the factor levels, respectively.
nlevels(x)
:
Returns the number of factor levels.
x <- Rle(10:1, 1:10)
x
sqrt(x)
x^2 + 2 * x + 1
range(x)
sum(x)
mean(x)
z <- c("the", "quick", "red", "fox", "jumps", "over", "the", "lazy", "brown", "dog")
z <- Rle(z, seq_len(length(z)))
chartr("a", "@", z)
toupper(z)
Run the code above in your browser using DataCamp Workspace