Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Surv() objects in conindex() #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: survivalsvm
Type: Package
Title: Survival Support Vector Analysis
Version: 0.0.5
Date: 2018-01-05
Version: 0.0.6
Date: 2018-11-30
Author: Cesaire J. K. Fouodo
Maintainer: Cesaire Fouodo <fouodo@imbs.uni-luebeck.de>
Description: Performs support vectors analysis for data sets with survival
Expand All @@ -24,6 +24,6 @@ Suggests:
Depends:
survival
License: GPL
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
URL: https://github.com/imbs-hl/survivalsvm
BugReports: https://github.com/imbs-hl/survivalsvm/issues
9 changes: 6 additions & 3 deletions R/perfomances.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @param obj [\code{survivalsvmprediction}]\cr
#' Object of class \code{survivalsvmprediction}.
#' @param Y [\code{vector}(1)]\cr
#' A numeric vector of truth survival times obeserved.
#' A \code{Surv()} object with true survival times observed.
#'
#' @export
#' @return [\code{Integer}]
Expand All @@ -17,9 +17,12 @@ conindex <- function(obj, Y){
if (is.null(obj$predicted)) {
stop("Error: field 'predicted' not found in 'obj'.")
}
if (!is.Surv(Y)) {
stop("Error: Y must be a Surv() object.")
}
X <- obj$predicted
if (length(X) != length(Y)) {
stop("Error: lengths do not macht.")
if (length(X) != nrow(Y)) {
stop("Error: lengths do not match.")
}
ci = Hmisc::rcorr.cens(x = X, S = Y)
return(ci["C Index"])
Expand Down
2 changes: 1 addition & 1 deletion man/conindex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.