Last chance! 50% off unlimited learning
Sale ends in
strip.missing
will return all names except those corresponding to formal arguments which were not set in the original call and which lack defaults. The output can safely be passed to get
.strip.missing( obs)
ls(all=TRUE)
returnList
funco <- function( first, second, third) {
a <- 9
return( do.call("returnList", lapply( strip.missing( ls()), as.name)))
}
funco( 1) # list( a=9, first=1)
funco( second=2) # list( a=9, second=2)
funco( ,,3) # list( a=9, third=3)
funco2 <- function( first=999) {
a <- 9
return( do.call("returnList", lapply( strip.missing( ls()), as.name)))
}
funco2() # list( a=9, first=999) even tho' "first" was not set
Run the code above in your browser using DataLab