Learn R Programming

UPMASK (version 1.2)

getStarsAtHighestDensityRegion: Perform cut in the membership list based on the 2D space distribution

Description

getStarsAtHighestDensityRegion will compute the 2D Kernel Density Estimation for the requested subset of data and will return only the stars in the most dense region.

Usage

getStarsAtHighestDensityRegion(ocdata_out, threshold=2, posIdx=c(1,2), 
plotAnalysis=FALSE, verbose=FALSE)

Arguments

ocdata_out

a data frame to use

threshold

a double with the thresholding level

posIdx

an array of integers indicating the columns of the data frame containing the spatial positions

plotAnalysis

a boolean indicating if the anaylsis should be plotted

verbose

a boolean indicating if the code should be verbose

Value

A data frame with the objects which were selected from ocdata_out

Examples

Run this code
# NOT RUN {
# Create a simple data set
toyDataDF <- data.frame(x=runif(50, 0, 10), y=runif(50, 0, 10), resMclust.class=rep(1, 50))
toyDataDF <- rbind(toyDataDF, data.frame(x=rnorm(50, 2, 3), 
                   y=rnorm(50, 4, 3), resMclust.class=rep(1, 50)))

# Perform the XY density based cut
toyRes <- getStarsAtHighestDensityRegion(toyDataDF)

# Clean the environment
rm(list=c("toyDataDF", "toyRes"))
 
# }

Run the code above in your browser using DataLab