name= "移网线上单" ,
Date_temp = format(Date_stemp,"%Y%m%d"), # 直接引用变量不执行,需加函数转为常量
Date_last_month_day = ymd("2021-08-31") , # 函数内变量名不要与外部变量名重复
Date_last_month_day1= ymd("2021-07-31") ,
cols=190 ){
x <- udf_DT(paste0(path,name,Date_temp,".xlsx") , 1 ,0)
y <- udf_DT(paste0(path,name,format(Date_last_month_day,"%Y%m%d"),".xlsx"),1,0)
z <- udf_DT(paste0(path,name,format(Date_last_month_day1,"%Y%m%d"),".xlsx"),1,0)
if(ncol(x)>70){
x <- x[,1:cols]
y <- y[,1:cols]
z <- z[,1:cols]}else{print("全列导入")}
setnames(y,names(x))
table <- rbind(x, y)
return(table)
}
mob_dev_2ilist <- udf_async_rbind( name = "移网线上单" )
输入了函数对象名称,可以直接看到代码的,如要获得函数对象fivenum的代码,就只需要在Console中键入函数对象名称fivenum就可以得到如下结果:function (x, na.rm = TRUE)
{
xna <- is.na(x)
if (na.rm)
x <- x[!xna]
else if (any(xna))
return(rep.int(NA, 5))
x <- sort(x)
n <- length(x)
if (n == 0)
rep.int(NA, 5)
else {
n4 <- floor((n + 3)/2)/2
d <- c(1, n4, (n + 1)/2, n + 1 - n4, n)
0.5 * (x[floor(d)] + x[ceiling(d)])
}
}