circular: Create Objects of class circular for Circular data.

View source: R/circular.R

circularR Documentation

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", "hours"),
  template = c("none", "geographics", "clock12", "clock24"),
  modulo = c("asis", "2pi", "pi"), 
  zero = 0, rotation = c("counter", "clock"), names)
## S3 method for class 'circular'
as(x, control.circular=list(), ...)
## S3 method for class 'circular'
is(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 coerced to a matrix.

type

the type of measures (Not Used Yet).

units

units of the measures.

template

how the data should be plotted. This set modulo, zero and rotation to some suitable values. For instance for 'geographics': zero=pi/2 and rotation='clock'. It is also used to set default labels on the plots.

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.

Author(s)

Claudio Agostinelli

See Also

conversion.circular

Examples

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)


circular documentation built on Sept. 11, 2024, 8:21 p.m.