[R] Does this exist: diff(range(VAR, na.rm=T))
    Ebert,Timothy Aaron 
    tebert @end|ng |rom u||@edu
       
    Wed Jun 25 21:32:17 CEST 2025
    
    
  
I do not see the problem.
In base R
Min <- min(var, na.rm=T)
Max <- max(var, na.rm=T)
Span <- c(Min, Max)
Is the same output as
Span <- range(var, na.rm=T)
diff(range(var, na.rm=T)) returns Max - Min
range() returns a vector with two values, the minimum and the maximum.
What should the function "span" do that is not already done?
Tim
-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Dennis Fisher
Sent: Wednesday, June 25, 2025 2:11 PM
To: r-help <r-help using r-project.org>
Subject: [R] Does this exist: diff(range(VAR, na.rm=T))
[External Email]
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
http://www.plessthan.com/
        [[alternative HTML version deleted]]
______________________________________________
R-help using 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.
    
    
More information about the R-help
mailing list