dplyr 新版本 1.0.0 消除了 tbl_cube 函数,我发现没有替代它

San*_*ado 5 arrays r ggplot2 dplyr tibble

我使用多维数组,当我需要绘图时,我通常将我的数据转换为 tibble through tbl_cube,然后用ggplot2. 今天新的dplyr 1.0.0更新到了CRAN,我发现现在tbl_cube已经不可用了。而且我找不到 tbl_cube 的替代品。我在今天之前做了类似这个玩具示例的事情来获得一个情节:

test_data1 <- array(1:50, c(5,5,2))
test_data2 <- array(51:100, c(5,5,2))

# list of my arrays
test_data <- list(exp1 = test_data1, exp2= test_data2)

# list of the dimentions
dims_list <- list(lat = 1:5, lon = 1:5, var = c('u','v'))

new_data <- as_tibble(tbl_cube(dimensions = dims_list, measures = test_data))

# Make some random plot
ggplot(new_data, aes(x=lon,y=lat)) +
geom_tile(aes(fill=exp2))+
geom_contour(aes(z=exp1),col='black')
Run Code Online (Sandbox Code Playgroud)

此示例运行并与以前的 dplyr 版本一起使用,但现在tbl_cube不再存在,因为不再存在。我知道在这个例子中,第三维不用于绘图,但我想表明我需要一些东西至少用于 3D 数组甚至 4D。

有关如何以简单的方式解决此问题的任何建议,例如tbl_cube