Learn R Programming

circular (version 0.3-7)

Circular: Create Objects of class circular for Circular data.

Description

The function circular is used to create circular objects. as.circular and is.circular coerce an object to a circular and test whether an object is a circular data.

Usage

circular(x, type = c("angles", "directions"), units = c("radians", "degrees"), template = c("none", "geographics"), modulo = c("asis", "2pi", "pi"), zero = 0, rotation = c("counter", "clock"), names)
as.circular(x, control.circular=list(), ...)
is.circular(x)
## S3 method for class 'circular':
print(x, info=TRUE, ...)

Arguments

x
a vector or a matrix. If a data.frame is supply then it is corced to a matrix.
type
the type of measures (Not Used Yet).
units
units of the measures.
template
how the data should be plotted (Until now only 'geographics' style is available). This set modulo, zero and rotation to some suitable values. For instance for 'geographics': zero=pi/2 and rotation='clock'. It is also
modulo
if we need to reduce the measures to modulo.
zero
the zero of the axes (in radians, counter).
rotation
the orientation of the axes.
names
names of the data.
info
if TRUE information on the properties of the data are printed.
control.circular
the attribute (coordinate system) used to coerced the resulting objects. See circular.
...
For as.circular an alternative way of setting the coordinate system of the resulting objects. Passed parameters to print.default for print.circular.

Value

  • an object of class circular. Since version 0.3-5 the previous class of the object is retain.

See Also

conversion.circular

Examples

Run this code
x <- circular(c(pi, pi/3, pi/4))
print(x)
is.circular(x)

x <- circular(runif(10, -pi/2, pi/2), template="geographics")
plot(x)
class(x)

x <- circular(data.frame(runif(10, -pi/2, pi/2)))
plot(x)
class(x)

cbind(x, x) # the matrix, cbind, rbind functions unclass and lost attributes! Use it with care.

x <- c(pi/12,2*pi+pi/12)print(x)
x <- unique(x)
print(x)

x[1]==x[2]

all.equal(x[1], x[2])

x <- as.circular(pi, control.circular=list(units="radians", zero=pi))
y <- conversion.circular(circular(pi), zero=pi)
res <- plot(x)
points(y, col=2, plot.info=res)

Run the code above in your browser using DataLab