sampleCMB: Take a simple random sample from a 'CMBDataFrame'

View source: R/Statistics.R

sampleCMBR Documentation

Take a simple random sample from a CMBDataFrame

Description

This function returns a CMBDataFrame which size equals to sample.size, whose rows comprise a simple random sample of the rows from the input CMBDataFrame.

Usage

sampleCMB(cmbdf, sample.size)

Arguments

cmbdf

a CMBDataFrame.

sample.size

the desired sample size.

Value

A CMBDataFrame which size equals to sample.size, whose rows comprise a simple random sample of the rows from the input CMBDataFrame.

Examples

## Download the map first
# downloadCMBMap(foreground = "smica", nside = 1024)
# df <- CMBDataFrame("CMB_map_smica1024.fits")
# plot(sampleCMB(df, sample.size = 800000))

df <- CMBDataFrame(nside = 16, I = rnorm(12 * 16 ^ 2), ordering = "nested")
df.sample <- sampleCMB(df, sample.size = 100)
df.sample


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