R/RcppExports.R

Defines functions cpp_regex_selector_name cpp_rep_na_num cpp_rep_na_chr cpp_bind cpp_valueOccurrencesToPoints

Documented in cpp_bind cpp_regex_selector_name cpp_rep_na_chr cpp_rep_na_num cpp_valueOccurrencesToPoints

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Extract Selector Name From Variable Name
#'
#' This function extract the selector name (e.g. 'var') from a variable name
#' like 'data$var'.
#'
#' This function basically takes variables names of the form
#' \code{(containingObject)$(selector)} as an input. With a regex command the
#' last selector - meaning the substring behind the last '$' - will be
#' extracted and returned. In case that the input parameter \code{x} does not
#' contain a selector, the empty string will be returned.
#'
#' @param x \code{std::string} containing the selector name (usually in the
#'          form \code{(containingObject)$(selector)}).
#'
#' @return \code{std::string} containing the extracted \code{selector} part.
#'         In case no selector can be found, the an empty string is returned.
#'
#' @examples
#'   # The outcome should be simply 'SalePrice'
#'   KaggleHouse:::cpp_regex_selector_name(data_train_na$SalePrice)
#'
cpp_regex_selector_name <- function(x) {
    .Call('KaggleHouse_cpp_regex_selector_name', PACKAGE = 'KaggleHouse', x)
}

#' Remove \code{NA} from \code{NumericVector}
#'
#' This function removes \code{NA} values from \code{NumericVector}s.
#'
#' This function accepts a numeric input vector and then replaces each
#' contained \code{NA} value with the \code{int} specified in the parameter
#' \code{rep}.
#'
#' @param  xin \code{NumericVector} potentially containing removable \code{NA}
#'             values.
#' @param  rep \code{int} value to replace \code{NA}s occuring in \code{xin}.
#'
#' @return \code{NumericVector} that is equal to \code{xin} except the
#'         \code{NA} values which have been replaced with \code{rep}.
#'
#' @examples
#' KaggleHouse:::cpp_rep_na_num(c(1, 2, NA), 3)
#'
cpp_rep_na_num <- function(xin, rep) {
    .Call('KaggleHouse_cpp_rep_na_num', PACKAGE = 'KaggleHouse', xin, rep)
}

#' Remove \code{NA} from \code{CharacterVector}
#'
#' This function removes \code{NA} values from \code{CharacterVector}s.
#'
#' This function accepts a character input vector and then replaces each
#' contained \code{NA} value with the \code{std::string} specified in the
#' parameter \code{rep}.
#'
#' @param  xin \code{CharacterVector} potentially containing removable
#'             \code{NA} values.
#' @param  rep \code{std::string} value to replace \code{NA}s occuring in
#'             \code{xin}.
#'
#' @return \code{CharacterVector} that is equal to \code{xin} except the
#'         \code{NA} values which have been replaced with \code{rep}.
#'
#' @examples
#' KaggleHouse:::cpp_rep_na_chr(c("a", "b", NA), "c")
#'
cpp_rep_na_chr <- function(xin, rep) {
    .Call('KaggleHouse_cpp_rep_na_chr', PACKAGE = 'KaggleHouse', xin, rep)
}

#' Combine two \code{NumericVector}s into a \code{NumericMatrix}
#'
#' This function combines two given \code{NumericVector}s into a
#' \code{NumericMatrix}. It thereby provides similar functionality as
#' \code{\link{base::cbind}}.
#'
#' @param a \code{NumericVector} representing the first column.
#' @param b \code{NumericVector} representing the second column.
#'
#' @return \code{NumericMatrix} being the combination of the two
#'         \code{NumericVector}s \code{a} and \code{b}.
cpp_bind <- function(a, b) {
    .Call('KaggleHouse_cpp_bind', PACKAGE = 'KaggleHouse', a, b)
}

#' Convert Value Occurences to Points
#'
#' This function converts a \code{data.frame} of feature characteristic
#' occurences to plottable points. For that the characteristic value is used
#' as the x-value. To visualize multiple occurences, each of them is assigned
#' a slightly higher y-position, so that multiple occurences of one
#' characteristic will later on stack in the plotted graph.
#'
#' @param x \code{data.frame} with the results of the \code{table} command on
#'           a given vector. \code{x} should contain the counts per
#'           characteristic of a specific feature.
#'
#' @return \code{List} including plottable point positions representing the
#'         counts of feature characteristics.
#'
#' @examples
#'   val <- rep(1:5, c(10, 20, 30, 40, 50))
#'   df <- as.data.frame(table(val))
#'   KaggleHouse:::cpp_valueOccurrencesToPoints(df)
cpp_valueOccurrencesToPoints <- function(x) {
    .Call('KaggleHouse_cpp_valueOccurrencesToPoints', PACKAGE = 'KaggleHouse', x)
}
MarcoNiemann/kaggle_house documentation built on May 7, 2019, 2:50 p.m.