Why not include a function resembling this: span <- function(x) { diff(range(x, na.rm=TRUE)) }
in your .Rprofile? It's simple, quick, and easier to type than diff(...) . ---JRG On Wednesday, June 25th, 2025 at 3:18 PM, Dennis Fisher <fis...@plessthan.com> wrote: > > > Duncan > > That would certainly be a possibility but it seems to me that this is > sufficiently simple to add to base R. If it is in a package, users would need > to install the package. > > Dennis > > > Dennis Fisher MD > P < (The "P Less Than" Company) > Phone: 1-415-307-4791 > www.PLessThan.com > > > On Jun 25, 2025, at 11:11 AM, Dennis Fisher fis...@plessthan.com wrote: > > > > Version 4.4.2 > > OS X > > > > Colleagues > > > > I often need to determine the span of the x-variable in a graphic. > > > > This is easy to determine with: > > diff(range(VAR, na.rm=T)) > > > > I am not aware of any function in base R that accomplishes this and “span” > > is not taken. > > > > Would it be possible to add such a function? Not a major addition but often > > useful. > > > > Dennis > > > > Dennis Fisher MD > > P < (The "P Less Than" Company) > > Phone: 1-415-307-4791 > > www.PLessThan.com > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.