min, max, and range (and many other functions) take the na.rm parameter to ignore NAs, but the Infs must be removed by hand as far as I know:
dat <- c(data1,data2,data3,data4) dat <- dat[(dat!=Inf)&(dat!=(-Inf))] rng <- range(dat, na.rm=TRUE) then use xlim = rng -- David Reiner -----Original Message----- From: Benjamin M. Osborne [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 16, 2005 4:04 PM To: [email protected] Subject: [R] scaling axes when plotting multiple data sets 1) When adding additional data sets to a plot using "plot" followed by "lines", is there a way to automate the scaling of the axes to allow for all data sets to fit within the plot area? 2) I attempted to solve this by setting xlim=c(min(c(data1,data2,data3)),max(c(data1,data2,data3))) however, there are some NAs and Infs in these data sets, and min(data1) and max(data1) both return NA, as with data2 and data3. (These are time series). Thank you, Ben Osborne -- Botany Department University of Vermont 109 Carrigan Drive Burlington, VT 05405 [EMAIL PROTECTED] phone: 802-656-0297 fax: 802-656-0440 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
