Dear Bert! Thanks for the answer. Just let me summarize the current (4.3.0) behavior.
DF <- data.frame(id = 1:2) DF[["ar"]] <- array(1:8, c(2,2,2)) #Converts array to vector #Removes dim and takes selected elements from first column DF[1,] # id ar #1 1 1 str(DF[1,]) #'data.frame': 1 obs. of 2 variables: # $ id: int 1 # $ ar: int 1 #Converts array to vector #Removes dim and takes selected elements DF[c(TRUE, FALSE),] # id ar #1 1 1 #Warning message: #In format.data.frame(if (omit) x[seq_len(n0), , drop = FALSE] else x, : # corrupt data frame: columns will be truncated or padded with NAs str(DF[c(TRUE, FALSE),]) #'data.frame': 1 obs. of 2 variables: # $ id: int 1 # $ ar: int 1 3 5 7 #Converts array to vector #Removes dim and takes selected elements from first column and #adds all elements form the remaining data DF[-2,] # id ar #1 1 1 #Warning message: #In format.data.frame(if (omit) x[seq_len(n0), , drop = FALSE] else x, : # corrupt data frame: columns will be truncated or padded with NAs str(DF[-2,]) #'data.frame': 1 obs. of 2 variables: # $ id: int 1 # $ ar: int 1 3 4 5 6 7 8 #Converts array to vector #Removes dim but keeps all elements DF[TRUE,] # id ar #1 1 1 #2 2 2 #Warning message: #In format.data.frame(if (omit) x[seq_len(n0), , drop = FALSE] else x, : # corrupt data frame: columns will be truncated or padded with NAs str(DF[TRUE,]) #'data.frame': 2 obs. of 2 variables: # $ id: int 1 2 # $ ar: int 1 2 3 4 5 6 7 8 Kind regards, Georg Gesendet: Donnerstag, 25. Mai 2023 um 19:15 Uhr Von: "Bert Gunter" <bgunter.4...@gmail.com> An: "Georg Kindermann" <georg.kinderm...@gmx.at> Cc: "Rui Barradas" <ruipbarra...@sapo.pt>, r-help@r-project.org Betreff: Re: Re: [R] data.frame with a column containing an array I really don't know. I would call it a request for extended capabilities of [.data.frame, rather than a feature or bug. But maybe wiser heads than mine who monitor this list can sort it out. -- Bert ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.