I work with multiple dimensional arrays and when I need to plot I usually convert my data to a tibble through tbl_cube
to then plot it with ggplot2
. Today the new dplyr 1.0.0
was updated to CRAN, and I found that now tbl_cube is no more available. And I could not found a replacement to tbl_cube. I did something like this toy example before today to get a plot:
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')
This example runs and works with previous dplyr release, but not now since tbl_cube
does not exist anymore. I know that in this example the third dimension is not used to do the plot but I wanted to show that I need something to used over at least a 3D array or even a 4D.
Any suggestion of how to solve this in an easy way such as tbl_cube
?