可以附加取决于arg1的arg2的默认值吗?
my_function <- function(arg1=df,
arg2=as.numeric(paste0(format(as.Date(max(df$myDate)),"%Y%m"),"01"))){
df2<-arg1[(arg1$myDate>=arg2),]
}
当我将他的值附加在arg2或corps中时,我没有相同的结果。例如:
my_function <- function(arg1=df){
arg2=as.numeric(paste0(format(as.Date(max(df$myDate)),"%Y%m"),"01"))
df2<-arg1[(arg1$myDate>=arg2),]
}