我发现Jenkins只是忽略了变量greet()
,谢谢您的帮助。
${BuildFolder}
答案 0 :(得分:0)
您可以在管道块开始之前创建变量。然后应该可以了。
例如,
library(data.table)
library(tidyverse)
list_df <- list(df1 = structure(list(c1. = c(1, 2, 3), c2 = c(4, 5, 6),
c3 = structure(1:3, .Label = c("a.", "b.", "c."), class = "factor"),
c4 = structure(1:3, .Label = c("d.", "e.", "f."), class = "factor"),
c5 = c(7, 8, 9), c6 = 10:12), class = "data.frame", row.names = c(NA, -3L)),
df2 = structure(list(c1. = c(1, 2, 3), c2 = c(4, 5, 6),
c2_1 = structure(1:3, .Label = c("a1.", "b.", "c."), class = "factor"),
c3 = structure(c(3L, 1L, 2L), .Label = c("7g", "9r", "b5."
), class = "factor"), c3_1 = structure(1:3, .Label = c("d.",
"e.", "f."), class = "factor"), c4 = structure(1:3, .Label = c("h",
"j", "l"), class = "factor"), c5 = c(7, 8, 9), c6 = 10:12), class = "data.frame", row.names = c(NA, -3L)))
microbenchmark::microbenchmark(
Khaynes = {lapply(list_df, function(x) setcolorder(x, c(1, ncol(x)-1, ncol(x))))},
Paweł_Chabros = {list_df %>% map(~select(.x, 1, ncol(.x) - 1, ncol(.x), 4:ncol(.x) - 2))},
Darren_Tsai = { map(list_df, ~ select(., c(1, ncol(.)-1, ncol(.)), everything()))}
)
# Unit: microseconds
# expr min lq mean median uq max neval
# Khaynes 92.301 100.551 148.872 116.251 134.2015 3165.401 100
# Pawel_Chabros 3001.502 3068.451 3264.070 3104.851 3156.4515 7476.001 100
# Darren_Tsai 2917.100 2981.801 3124.193 3021.651 3061.3010 7383.101 100