Description Usage Arguments Value Examples
View source: R/CMBDataFrameGenerics.R
Safely converts a data.frame
to a CMBDataFrame. The
rows of the data.frame are assumed to be in the HEALPix order
given by ordering
, and at the HEALPix resolution given
by nside
. Coordinates, if present, are assumed to correspond to
HEALPix pixel centers. The coordinates must be named either x,y,z
(cartesian) or theta, phi (spherical colatitude and longitude respectively).
If df
is a HPDataFrame
then
it is possible that df
has attribute healpixCentered = TRUE
,
in which case as.CMBDataFrame
will perform HEALPix centering of
coordinates.
1 | as.CMBDataFrame(df, ordering, nside, spix, drop.coords = FALSE)
|
df |
Any |
ordering |
character string that specifies the ordering scheme ("ring" or "nested") |
nside |
an integer 2^k that specifies the Nside (resolution) HEALPix parameter |
spix |
an integer vector that specifies the HEALPix pixel index
corresponding to each row of |
drop.coords |
A logical. If |
A CMBDataFrame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Example 1: Create df with no coords, then create CMBDataFrames cmbdf and
## df2 with spherical coords
df <- data.frame(I=rnorm(12))
df
cmbdf <- as.CMBDataFrame(df,ordering= "ring", nside=1)
summary(cmbdf)
pix(cmbdf)
coords(cmbdf)
df2 <- coords(cmbdf, new.coords = "spherical")
df2
## Example 2: Create CMBDataFrames for first 10 Healpix centers
df <- data.frame(I=rnorm(10))
df
cmbdf <- as.CMBDataFrame(df,ordering= "ring", nside=2, spix=1:10)
summary(cmbdf)
pix(cmbdf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.