Merge branch 'master' into 1.0.4-develop

This commit is contained in:
Joel Therrien 2019-07-24 10:54:21 -07:00
commit af0c8f2e96
12 changed files with 40 additions and 18 deletions

View file

@ -8,7 +8,7 @@
#' #'
#' @param delta A vector of integers detailing the event that occurred. A value #' @param delta A vector of integers detailing the event that occurred. A value
#' of 0 denotes that censoring occurred first and that time was recorded. #' of 0 denotes that censoring occurred first and that time was recorded.
#' @param u A vector of numerics detailing the recorded event times (possibly #' @param u A numeric vector detailing the recorded event times (possibly
#' censored). #' censored).
#' @param C If the censoring times are known for all observations, they can be #' @param C If the censoring times are known for all observations, they can be
#' included which allows for \code{\link{GrayLogRankSplitFinder}} to be used. #' included which allows for \code{\link{GrayLogRankSplitFinder}} to be used.

View file

@ -1,7 +1,10 @@
#' Numeric #' Numeric
#' #'
#' An internal function that converts an R vector of numerics or integers into an R list containing java.lang.Double objects. This method does not need to be used directly by the user, as \code{\link{train}} will automatically handle numeric responses if you're working in the regression settings. #' An internal function that converts an R vector of numerics or integers into
#' an R list containing java.lang.Double objects. This method does not need to
#' be used directly by the user, as \code{\link{train}} will automatically
#' handle numeric responses if you're working in the regression settings.
#' @param y The R vector of numbers #' @param y The R vector of numbers
#' @export #' @export
#' @return An R list containing rJava Doubles. #' @return An R list containing rJava Doubles.

View file

@ -9,8 +9,8 @@
#' @param forest An existing forest. #' @param forest An existing forest.
#' @param numTreesToAdd The number of trees to add. #' @param numTreesToAdd The number of trees to add.
#' @param savePath If saving the forest, the directory to save to. Default is #' @param savePath If saving the forest, the directory to save to. Default is
#' \code{NULL}. Note that you need to respecify the path if you're modifying a #' \code{NULL}. Note that you need to re-specify the path if you're modifying
#' previously saved forest. #' a previously saved forest.
#' @param savePath.overwrite If \code{savePath} is pointing to an existing #' @param savePath.overwrite If \code{savePath} is pointing to an existing
#' directory, possibly containing another forest, this specifies what should #' directory, possibly containing another forest, this specifies what should
#' be done. #' be done.

View file

@ -10,7 +10,7 @@
#' The user only needs to pass this object into \code{\link{train}} as the #' The user only needs to pass this object into \code{\link{train}} as the
#' \code{forestResponseCombiner} parameter. #' \code{forestResponseCombiner} parameter.
#' #'
#' @param events A vector of integers specifying which competing risk events's #' @param events A vector of integers specifying which competing risks event
#' functions should be processed. This should correspond to all of the #' functions should be processed. This should correspond to all of the
#' competing risk events that can occur, from 1 to the largest number. #' competing risk events that can occur, from 1 to the largest number.
#' @param times An optional numeric vector that forces the output functions to #' @param times An optional numeric vector that forces the output functions to
@ -66,7 +66,7 @@ CR_FunctionCombiner <- function(events, times = NULL){
#' The user only needs to pass this object into \code{\link{train}} as the #' The user only needs to pass this object into \code{\link{train}} as the
#' \code{nodeResponseCombiner} parameter. #' \code{nodeResponseCombiner} parameter.
#' #'
#' @param events A vector of integers specifying which competing risk events's #' @param events A vector of integers specifying which competing risks event
#' functions should be processed. This should correspond to all of the #' functions should be processed. This should correspond to all of the
#' competing risk events that can occur, from 1 to the largest number. #' competing risk events that can occur, from 1 to the largest number.
#' @export #' @export

View file

@ -48,6 +48,10 @@ extractCIF <- function (x, event) {
#' @export #' @export
extractCIF.CompetingRiskFunctions <- function(x, event){ extractCIF.CompetingRiskFunctions <- function(x, event){
if(is.null(event) | anyNA(event)){
stop("event must be specified")
}
fun <- stats::stepfun(x$time.interest, c(0, x$cif[,event])) fun <- stats::stepfun(x$time.interest, c(0, x$cif[,event]))
class(fun) <- "function" class(fun) <- "function"
@ -57,6 +61,10 @@ extractCIF.CompetingRiskFunctions <- function(x, event){
#' @export #' @export
extractCIF.CompetingRiskFunctions.List <- function(x, event){ extractCIF.CompetingRiskFunctions.List <- function(x, event){
if(is.null(event) | anyNA(event)){
stop("event must be specified")
}
return(lapply(x, extractCIF.CompetingRiskFunctions, event)) return(lapply(x, extractCIF.CompetingRiskFunctions, event))
} }
@ -70,6 +78,10 @@ extractCHF <- function (x, event) {
#' @export #' @export
extractCHF.CompetingRiskFunctions <- function(x, event){ extractCHF.CompetingRiskFunctions <- function(x, event){
if(is.null(event) | anyNA(event)){
stop("event must be specified")
}
fun <- stats::stepfun(x$time.interest, c(0, x$chf[,event])) fun <- stats::stepfun(x$time.interest, c(0, x$chf[,event]))
class(fun) <- "function" class(fun) <- "function"
@ -79,6 +91,10 @@ extractCHF.CompetingRiskFunctions <- function(x, event){
#' @export #' @export
extractCHF.CompetingRiskFunctions.List <- function(x, event){ extractCHF.CompetingRiskFunctions.List <- function(x, event){
if(is.null(event) | anyNA(event)){
stop("event must be specified")
}
return(lapply(x, extractCHF.CompetingRiskFunctions, event)) return(lapply(x, extractCHF.CompetingRiskFunctions, event))
} }

View file

@ -4,7 +4,7 @@
# it's in the inst folder which won't be present if the package was actually # it's in the inst folder which won't be present if the package was actually
# loaded from the R library). Thus with morePaths we make sure it loads up the # loaded from the R library). Thus with morePaths we make sure it loads up the
# jar in this situation. # jar in this situation.
.jpackage(pkgname, lib.loc=libname, morePaths="inst/java/largeRCRF-1.0-SNAPSHOT.jar") .jpackage(pkgname, lib.loc=libname, morePaths="inst/java/largeRCRF-library-1.0-SNAPSHOT.jar")
} }

View file

@ -2,4 +2,4 @@ The Java source code for this package can be obtained at https://github.com/jath
* Delete the Jar file in `inst/java/` * Delete the Jar file in `inst/java/`
* Build the Java code in its own separate directory using `mvn clean package` in the root of the directory (same folder containing `README.md`). Make sure you have [Maven](https://maven.apache.org/) installed. * Build the Java code in its own separate directory using `mvn clean package` in the root of the directory (same folder containing `README.md`). Make sure you have [Maven](https://maven.apache.org/) installed.
* Copy the `library/target/largeRCRF-library/1.0-SNAPSHOT.jar` file produced in the Java directory into `inst/java/` * Copy the `library/target/largeRCRF-library-1.0-SNAPSHOT.jar` file produced in the Java directory into `inst/java/`

View file

@ -7,7 +7,7 @@
CR_FunctionCombiner(events, times = NULL) CR_FunctionCombiner(events, times = NULL)
} }
\arguments{ \arguments{
\item{events}{A vector of integers specifying which competing risk events's \item{events}{A vector of integers specifying which competing risks event
functions should be processed. This should correspond to all of the functions should be processed. This should correspond to all of the
competing risk events that can occur, from 1 to the largest number.} competing risk events that can occur, from 1 to the largest number.}

View file

@ -10,7 +10,7 @@ CR_Response(delta, u, C = NULL)
\item{delta}{A vector of integers detailing the event that occurred. A value \item{delta}{A vector of integers detailing the event that occurred. A value
of 0 denotes that censoring occurred first and that time was recorded.} of 0 denotes that censoring occurred first and that time was recorded.}
\item{u}{A vector of numerics detailing the recorded event times (possibly \item{u}{A numeric vector detailing the recorded event times (possibly
censored).} censored).}
\item{C}{If the censoring times are known for all observations, they can be \item{C}{If the censoring times are known for all observations, they can be

View file

@ -7,7 +7,7 @@
CR_ResponseCombiner(events) CR_ResponseCombiner(events)
} }
\arguments{ \arguments{
\item{events}{A vector of integers specifying which competing risk events's \item{events}{A vector of integers specifying which competing risks event
functions should be processed. This should correspond to all of the functions should be processed. This should correspond to all of the
competing risk events that can occur, from 1 to the largest number.} competing risk events that can occur, from 1 to the largest number.}
} }

View file

@ -13,7 +13,10 @@ Numeric(y)
An R list containing rJava Doubles. An R list containing rJava Doubles.
} }
\description{ \description{
An internal function that converts an R vector of numerics or integers into an R list containing java.lang.Double objects. This method does not need to be used directly by the user, as \code{\link{train}} will automatically handle numeric responses if you're working in the regression settings. An internal function that converts an R vector of numerics or integers into
an R list containing java.lang.Double objects. This method does not need to
be used directly by the user, as \code{\link{train}} will automatically
handle numeric responses if you're working in the regression settings.
} }
\examples{ \examples{
x <- Numeric(1:5) x <- Numeric(1:5)

View file

@ -14,8 +14,8 @@ addTrees(forest, numTreesToAdd, savePath = NULL,
\item{numTreesToAdd}{The number of trees to add.} \item{numTreesToAdd}{The number of trees to add.}
\item{savePath}{If saving the forest, the directory to save to. Default is \item{savePath}{If saving the forest, the directory to save to. Default is
\code{NULL}. Note that you need to respecify the path if you're modifying a \code{NULL}. Note that you need to re-specify the path if you're modifying
previously saved forest.} a previously saved forest.}
\item{savePath.overwrite}{If \code{savePath} is pointing to an existing \item{savePath.overwrite}{If \code{savePath} is pointing to an existing
directory, possibly containing another forest, this specifies what should directory, possibly containing another forest, this specifies what should