coords.CMBDataFrame: Coordinate system from a 'CMBDataFrame'

View source: R/CMBDataFrameGenerics.R

coords.CMBDataFrameR Documentation

Coordinate system from a CMBDataFrame

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

## 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


## 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)


frycast/rcosmo documentation built on Oct. 11, 2022, 5:21 p.m.