Dear R community. I am using the identify() function to identify outliers in my dataset. This is the code I am using:
#################################################################### # Function to allow identifying points in the QQ plot (by mouseclicking) qqInteractive <- function(..., IDENTIFY = TRUE) { qqplot(...) -> X abline(a=0,b=1) if(IDENTIFY) return(identify(X)) invisisble(X) } qqplot.mv.interactive <- function (data, xlim=NULL, ylim=NULL) { x <- as.matrix(data) # n x p numeric matrix center <- colMeans(x) # centroid n <- nrow(x); p <- ncol(x); cov <- cov(x); d <- mahalanobis(x,center,cov) # distances qqInteractive(qchisq(ppoints(n),df=p),d, # ppoints(n) makes a sequence from 0 to 1. with stepsize 1/n main="QQ Plot Assessing Multivariate Normality", # qchisq() makes a chi squared distribution function for the given probabilities in ppoints(n) and degress of freedom df ylab="Mahalanobis D2", xlim=xlim, ylim=ylim) #abline(a=0,b=1) } y <- c((1:100)+rnorm(100, sd=100)) x <- c(1:100) windows();qqInteractive(x,y) #################################################################### When i click the points in the graph identify() only returns the number of the points in the order they are lying on the X-axis. Let's say I mark the point in the upper right corner, identify() will return 100. But what I want is the number in the original dataset y. Lets say the point was at y[87]. Otherwise I wont be able to remove this point from my original dataset. I hope you understand my problem. I apreciate every help. Regards, Daniel Hoop -- View this message in context: http://r.789695.n4.nabble.com/identify-doesn-t-return-true-numbers-tp4626273.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.