window.data.frame: Get a sub window from a data.frame

Description Usage Arguments Details Value Examples

Description

This function returns a data.frame containing the data in x restricted to the CMBWindow new.window

Usage

1
2
## S3 method for class 'data.frame'
window(x, new.window, intersect = TRUE, ...)

Arguments

x

A data.frame. Must have columns labelled x,y,z specifying cartesian coordinates, or columns labelled theta, phi specifying colatitude and longitude respectively.

new.window

A single CMBWindow object or a list of them.

intersect

A boolean that determines the behaviour when new.window is a list containing BOTH regular type and "minus" type windows together (see details).

...

Unused arguments.

Details

Windows that are tagged with set.minus (see CMBWindow) are treated differently from other windows.

If the argument is a list of CMBWindows, then interiors of all windows whose winType does not include "minus" are united (let A be their union) and exteriors of all windows whose winType does include "minus" are intersected, (let B be their intersection). Then, provided that intersect = TRUE (the default), the returned data.frame will be the points of x in the the intersection of A and B. Otherwise, if intersect = FALSE, the returned data.frame consists of the points of x in the union of A and B.

Note that if A (resp. B) is empty then the returned data.frame will be the points of x in B (resp. A).

Value

A data.frame containing the data in x restricted to the CMBWindow new.window

Examples

1
2
3
4
5
6
7
8
win1 <- CMBWindow(theta = c(0,pi/2,pi/2), phi = c(0,0,pi/2))

cmbdf <- CMBDataFrame(nside = 4)
df2 <- coords(cmbdf, new.coords = "cartesian")
df <- as.data.frame(df2[,1:3])
df
df.win <- window(df, new.window = win1)
df.win

frycast/rcosmo documentation built on June 4, 2019, 5:13 p.m.