diff --git a/R/observationInfluence.R b/R/observationInfluence.R index 12c49c0b..69f10e88 100644 --- a/R/observationInfluence.R +++ b/R/observationInfluence.R @@ -11,7 +11,7 @@ observationInfluence <- function(object, ...){ cooksDistances <- scoreCooksDistance(object, ...) - result <- data.frame(cooks.dist = cooksDistances, label = object$label, index = rownames(object$data)) + result <- data.frame(cooks.dist = cooksDistances, label = object$label, index = 1:length(object$y)) result <- result[order(-result$cooks.dist),] class(result) <- c("observationInfluence", "data.frame") diff --git a/R/plotCooksDistance.R b/R/plotCooksDistance.R index 2c95889e..1bc8f039 100644 --- a/R/plotCooksDistance.R +++ b/R/plotCooksDistance.R @@ -48,7 +48,7 @@ plotCooksDistance <- function(object, nlabel = 3, ...){ ggplot(df, aes(index, cooks.dist)) + geom_point() + - geom_text(data = subset(df, big==TRUE), aes(label=as.character(index)),hjust=-0.2,vjust=-0.2) + + geom_text(data = subset(df, big==TRUE), aes(label=as.character(index)), color = "grey") + facet_grid(label ~ .) + xlab("observation index") + ylab("cook's distance") +