Hello, I've got a matrix (mail end) with the colnames x, y, z. In this matrix are different measurements. x and y are risign coordinates.
With the following line I got the median value of z for all "x" AND "y" witch are the same (not every measurment in my list hast the same number of "x" and "y" values. Sometimes lines are missing. >MEDIAN <- na.omit( aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1] ), >FUN=median ) ) To see the failin of my measurments I want to get the difference between every measurment and the detected median values. The aim would be to have a list with different colums (for every measurment) with the difference between measurment 1,2,3, ..., x and the median. Has anybody an idea? I though I could split the measurment list. The beginning of every measurment can be found with >START <- grep(" 0 0.0 0.00000000", INPUT) But not every measurment has the same length and I don't have always the same number of measurments. I hope you can help me. Thank's a lot. Felix ############### ## My R Code ## ############### INPUT <- readLines(dat.dat) INPUT <- gsub("^ ", "", INPUT) INPUT <- t( sapply( strsplit(INPUT, split=" "), as.numeric ) ) colnames(INPUT) <- c("x", "y", "z" ) ############# ## dat.dat ## ############# 29 4.5 1.505713 29 4.6 1.580402 29 4.7 1.656875 29 4.8 1.735054 30 0 0 30 0.1 0.00096108 30 0.2 0.00323831 29 4.5 1.495148 29 4.6 1.568961 29 4.7 1.644467 30 0 0 30 0.1 0.00093699 30 0.2 0.00319411 30 0.3 0.00676619" ______________________________________________ R-help@stat.math.ethz.ch 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.