I was trying to convert a very simple 1x4 tibble to an array:
library(tidyverse)
temp <- tibble(x=0,y=1,z=1,w=1)
array(temp)
It gives me the following error messages:
Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : zero-length inputs cannot be mixed with those of non-zero length In addition: Warning messages: 1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL' 2: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
Within the array function it seems like dim(data) <- dim part is the problem... I did figure out a solution, which is to turn the tibble into a dataframe:
array(as.data.frame(temp))
But I'm not quite sure why I have to go through an extra step. Could somebody tell me what I'm missing?