I have preallocated a 3D array and try to fill it with data. However, whenever I do this with a previously defined data.frame collumn, the array gets mysteriously converted to a list, which messes up everything. Converting the data.frame collumn to a vector does not help it.
Example:
exampleArray <- array(dim=c(3,4,6))
exampleArray[2,3,] <- c(1:6) # direct filling works perfectly
exampleArray
str(exampleArray) # output as expected
Problem:
exampleArray <- array(dim=c(3,4,6))
exampleContent <- as.vector(as.data.frame(c(1:6)))
exampleArray[2,3,] <- exampleContent # filling array from a data.frame column
# no errors or warnings
exampleArray
str(exampleArray) # list-like output!
Is there any way I can get around this and fill up my array normally?
Thanks for your suggestions!