Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved key= into ... of as.data.table generic #3852

Merged
merged 1 commit into from
Sep 10, 2019
Merged

moved key= into ... of as.data.table generic #3852

merged 1 commit into from
Sep 10, 2019

Conversation

mattdowle
Copy link
Member

Resolves riskRegression in #3581

@mattdowle mattdowle added this to the 1.12.4 milestone Sep 10, 2019
@mattdowle mattdowle mentioned this pull request Sep 10, 2019
31 tasks
@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

Merging #3852 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3852   +/-   ##
=======================================
  Coverage   99.42%   99.42%           
=======================================
  Files          71       71           
  Lines       13412    13412           
=======================================
  Hits        13335    13335           
  Misses         77       77
Impacted Files Coverage Δ
R/as.data.table.R 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8bda20b...0c67e61. Read the comment docs.

@mattdowle mattdowle merged commit c95c86a into master Sep 10, 2019
@mattdowle mattdowle deleted the as_method branch September 10, 2019 20:12
@@ -1,4 +1,5 @@
as.data.table = function(x, keep.rownames=FALSE, key=NULL, ...)
as.data.table = function(x, keep.rownames=FALSE, ...)
# cannot add new args before dots otherwise revdeps which implement their methods will start to warn; e.g. riskRegression in #3581
Copy link
Member

@jangorecki jangorecki Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why not adding key after dots then? or asking revdep to update. Such a warning is not a problem for production systems

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding arguments after ... has some wrinkles in the past. I can't quite remember what the problem is, but isn't ... supposed to be last?
It works, so why add key=NULL after dots?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of base examples with dots in the middle (e.g. sapply)... just means you always have to name that argument.

idea of including is to signal its importance in general for this method. how many as.data.table methods don't accept key?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arguments that are after ... has to be always match by name, I can't recall anything other.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's something about S3 generics as well, can't recall off the top of my head

Copy link
Member

@MichaelChirico MichaelChirico Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For edification: 106 base functions with arguments after ... (including as.data.frame, the closest cousin):

names(Filter(function(x) is.function(x) && '...' %chin% (nm <- names(formals(x))) && tail(nm, 1L) != '...',
+              mget(ls(base <- asNamespace('base')), envir = base)))
  [1] "[.Date"                        "[.difftime"                    "[.factor"                     
  [4] "[.POSIXct"                     "[.table"                       "[[.data.frame"                
  [7] "[[.Date"                       "[[.numeric_version"            "[[.POSIXct"                   
 [10] "[[<-.factor"                   "[[<-.numeric_version"          "[<-.Date"                     
 [13] "[<-.factor"                    "[<-.POSIXct"                   "all.equal.character"          
 [16] "all.equal.factor"              "all.equal.list"                "all.equal.numeric"            
 [19] "all.equal.POSIXt"              "all.equal.raw"                 "as.data.frame.character"      
 [22] "as.data.frame.complex"         "as.data.frame.Date"            "as.data.frame.difftime"       
 [25] "as.data.frame.factor"          "as.data.frame.integer"         "as.data.frame.list"           
 [28] "as.data.frame.logical"         "as.data.frame.matrix"          "as.data.frame.noquote"        
 [31] "as.data.frame.numeric"         "as.data.frame.numeric_version" "as.data.frame.ordered"        
 [34] "as.data.frame.POSIXct"         "as.data.frame.raw"             "as.data.frame.table"          
 [37] "as.data.frame.vector"          "attr.all.equal"                "by"                           
 [40] "by.data.frame"                 "by.default"                    "c.Date"                       
 [43] "c.difftime"                    "c.noquote"                     "c.numeric_version"            
 [46] "c.POSIXct"                     "c.POSIXlt"                     "c.warnings"                   
 [49] "cat"                           "cbind"                         "cbind.data.frame"             
 [52] "chkDots"                       "data.frame"                    "eapply"                       
 [55] "errorCondition"                "expand.grid"                   "file.create"                  
 [58] "file.info"                     "file.path"                     "file.show"                    
 [61] "format.data.frame"             "gettext"                       "gettextf"                     
 [64] "interaction"                   "mapply"                        "message"                      
 [67] "namespaceImport"               "order"                         "packageStartupMessage"        
 [70] "paste"                         "paste0"                        "pmax"                         
 [73] "pmax.int"                      "pmin"                          "pmin.int"                     
 [76] "print.by"                      "print.data.frame"              "range.default"                
 [79] "rbind"                         "rbind.data.frame"              "remove"                       
 [82] "requireNamespace"              "rm"                            "sapply"                       
 [85] "save"                          "split<-"                       "split<-.data.frame"           
 [88] "split<-.default"               "stop"                          "stopifnot"                    
 [91] "Summary.data.frame"            "Summary.Date"                  "summary.default"              
 [94] "Summary.difftime"              "Summary.factor"                "Summary.numeric_version"      
 [97] "Summary.ordered"               "Summary.POSIXct"               "Summary.POSIXlt"              
[100] "system.file"                   "table"                         "tapply"                       
[103] "tryCatch"                      "vapply"                        "warning"                      
[106] "warningCondition" 

Another 100 or so among the other default loads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants