我目前正在使用该tidyr包来解除列表列的嵌套。然而,我正在寻找一种更快的方法并转向data.table(我是一个菜鸟)。考虑以下示例:
dt1 <- data.table::data.table(
a = c("a1", "a2"),
df1 = list(data.frame(
b = c("b1", "b2")
))
)
tidyr::unnest(dt1, df1)
#> # A tibble: 4 x 2
#> a b
#> <chr> <chr>
#> 1 a1 b1
#> 2 a1 b2
#> 3 a2 b1
#> 4 a2 b2
dt1[, data.table::rbindlist(df1), by = .(a)]
#> a b
#> 1: a1 b1
#> 2: a1 b2
#> 3: a2 b1
#> 4: a2 b2
Created on 2021-06-22 by …Run Code Online (Sandbox Code Playgroud) 我想让我的主机上的文件夹在RUN声明期间可用。也就是说,类似于容器运行的效果-v:
docker run -v /path/on/host:/path/in/container mycontainer:tag
Run Code Online (Sandbox Code Playgroud)
在容器中,这为我/path/in/container提供了path/on/host.
为此,我正在尝试https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md 中的实验挂载选项:
RUN --mount=type=bind,target=/path/on/host
Run Code Online (Sandbox Code Playgroud)
这/path/on/host在RUN.
然后我有两个问题:
我可以ls在里面文件/path/on/host,但不能使用它们(例如cat它们)。我试图改变type到如cache使用source像https://devops.stackexchange.com/questions/6078/in-a-dockerfile-is-there-a-way-to-avoid-copying-files-to-make- them-accessible-t,但我无法让它工作。
我无法弄清楚如何在“RUN图像”中使用不同的路径,即,/path/in/container而不是/path/on/host.