coords.CMBDataFrame: Coordinate system from a 'CMBDataFrame'

Description Usage Arguments Value Examples

View source: R/CMBDataFrameGenerics.R

Description

If new.coords is unspecified then this function returns the coordinate system used in the CMBDataFrame cmbdf. The coordinate system is either "cartesian" or "spherical". If a new coordinate system is specified, using e.g. new.coords = "spherical", then this function instead returns a new CMBDataFrame whose coordinates are of the specified type. The original CMBDataFrame, cmbdf, is unaffected. If you would like to change cmbdf without creating a new variable, then use coords<-.CMBDataFrame (see examples below).

Usage

1
2
## S3 method for class 'CMBDataFrame'
coords(x, new.coords, ...)

Arguments

x

A CMBDataFrame, cmbdf.

new.coords

Specifies the new coordinate system ("spherical" or "cartesian") if a change of coordinate system is desired.

...

Unused arguments.

Value

If new.coords is unspecified, then the name of the coordinate system of cmbdf is returned. Otherwise a new CMBDataFrame is returned equivalent to cmbdf but having the desired change of coordinates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Create df with no coords, then create df2 with cartesian coords
df <- CMBDataFrame(nside = 16)
df
coords(df)
df2 <- coords(df, new.coords = "cartesian")
coords(df2)


## Change the coords of df directly (to spherical)
coords(df) <- "spherical"
coords(df)

rcosmo documentation built on Feb. 14, 2020, 5:06 p.m.