for data.frame: for(j in grep('Laser_', names(m)) lines(m[,j]) for matrix: for(j in grep('Laser_', colnames(m)) lines(m[,j])
or for(j in 2:4) lines(m[,j]) Shorter could be worse if you insert additional columns later. -- View this message in context: http://r.789695.n4.nabble.com/Plot-a-matrix-recursively-tp3067283p3106041.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ 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.