R/td.quantiles.R

Defines functions td.quantiles

Documented in td.quantiles

td.quantiles <- function(tdf, col, qType = c("ter", "quar", "dec")) {
    if (!is.td.data.frame(tdf)) 
        stop("'tdf' is not a td data frame")
    if (!length(names(tdf))) 
        stop("td.data.frame contains no columns")
    if (!all(qType %in% c("ter", "quar", "dec"))) 
        stop("'qType' is not a valid type.")
    if (missing(col)) 
        col <- .td.gencolumnexpr(tdf[names(tdf)[1]]) else col <- .td.gencolumnexpr(tdf[col])
    
    query <- .td.genquantiles(tdf, col, qType)
    df <- try(tdQuery(query))
    if (is.null(class(df))) 
        stop("Error retrieving quantile values from table.")
    return(df)
}
 
nonsleepr/teradataR documentation built on May 23, 2017, 4:47 p.m.