File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11#   File src/library/base/R/version.R
22#   Part of the R package, https://www.R-project.org
33# 
4- #   Copyright (C) 1995-2024  The R Core Team
4+ #   Copyright (C) 1995-2025  The R Core Team
55# 
66#   This program is free software; you can redistribute it and/or modify
77#   it under the terms of the GNU General Public License as published by
@@ -345,6 +345,8 @@ function(..., recursive = FALSE)
345345duplicated.numeric_version  <- 
346346function (x , incomparables  =  FALSE , ... )
347347{
348+     n  <-  length(x )
349+     if  (n  <  2L ) return (logical (n ))
348350    x  <-  unclass(x )
349351    lens  <-  lengths(x , use.names  =  FALSE )
350352    need  <-  max(lens ) -  lens 
Original file line number Diff line number Diff line change @@ -1867,6 +1867,18 @@ stopifnot(exprs = {
18671867# # all these used to error in reformulate()  in R < 4.5.0
18681868
18691869
1870+ # # duplicated(<numeric_version>), especially for empty input
1871+ options(warn  =  2 ) #  should already be set from the top
1872+ x  <-  numeric_version(" 1" 
1873+ stopifnot(exprs  =  {
1874+     identical(duplicated(x [NULL ]), logical (0L )) #  should not warn
1875+     identical(duplicated(x ), FALSE )
1876+     identical(duplicated(c(x ,x )), c(FALSE , TRUE ))
1877+ })
1878+ # # only in R-devel with PR#18699, the first produced a warning
1879+ # # In max(lens) : no non-missing arguments to max; returning -Inf
1880+ 
1881+ 
18701882
18711883# # keep at end
18721884rbind(last  =   proc.time() -  .pt ,
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments