Skip to contents

as_coord1d() casts to a Coord1D class object

Usage

as_coord1d(x, ...)

# S3 method for class 'character'
as_coord1d(x, ...)

# S3 method for class 'Coord2D'
as_coord1d(
  x,
  permutation = c("xy", "yx"),
  ...,
  line = as_line2d("x-axis"),
  scale = 0
)

# S3 method for class 'data.frame'
as_coord1d(x, ...)

# S3 method for class 'list'
as_coord1d(x, ...)

# S3 method for class 'matrix'
as_coord1d(x, ...)

# S3 method for class 'numeric'
as_coord1d(x, ...)

# S3 method for class 'Coord1D'
as_coord1d(x, ...)

# S3 method for class 'Point1D'
as_coord1d(x, ...)

Arguments

x

An object that can be cast to a Coord1D class object such as a numeric vector of x-coordinates.

...

Further arguments passed to or from other methods

permutation

Either "xy" (no permutation) or "yx" (permute x and y axes)

line

A Line2D object of length one representing the line you with to reflect across or project to or an object coercible to one by as_line2d(line, ...) such as "x-axis" or "y-axis".

scale

Oblique projection scale factor. A degenerate 0 value indicates an orthogonal projection.

Value

A Coord1D class object

Examples

as_coord1d(x = rnorm(10))
#> <Coord1D[10]>
#>                x w
#>  [1,]  0.2360958 1
#>  [2,]  0.6289534 1
#>  [3,]  0.4179257 1
#>  [4,]  1.9767585 1
#>  [5,] -0.5062863 1
#>  [6,] -1.1099689 1
#>  [7,] -0.9487057 1
#>  [8,]  0.4768438 1
#>  [9,] -0.7952016 1
#> [10,]  0.2343269 1