Hello, Considering 5 points in X-Y plain. Data is a 5*2 matrix (5 rows for samples & 2 columns for X and Y) With a distance from the origin, if a distance < 7, remove the row from the Data.
After calculating the distance for each point, I can't forward because of this "Removing" problem. Anyone can help me? Data=matrix(1:10,5,2) a=rep(0,5); b=rep(0,5); for (i in 1:5)) { for (k in 1:2) { a[i,k]=a[i,k]+(Data[i,k])^2 } b[i,j]=(a[i,j])^0.5 # distance from the origin } Thank you, Jin -- View this message in context: http://old.nabble.com/Removing-rows-which-do-not-satisfy-a-condition-tp26484778p26484778.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.