0
3D 배열을 미리 할당하고 데이터로 채 웁니다. 그러나 이전에 정의 된 data.frame collumn을 사용하여이 작업을 수행 할 때마다 배열이 신비하게 목록으로 변환되어 모든 것을 망칩니다. data.frame collumn을 벡터로 변환해도 도움이되지 않습니다.R에 3D 배열 채우기 : 강제 변환을 피하는 방법?
예 :
exampleArray <- array(dim=c(3,4,6))
exampleArray[2,3,] <- c(1:6) # direct filling works perfectly
exampleArray
str(exampleArray) # output as expected
문제 :
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!
나는이 문제를 해결 얻고 일반적으로 내 배열을 채울 수있는 방법이 있나요?
의견을 보내 주셔서 감사합니다.
가 좋아, 너무 작은 ","차이를 만든다! 고마워요! – jgoldmann