[R] initiate elements in a dataframe with lists
Ivan Calandra
c@|@ndr@ @end|ng |rom rgzm@de
Wed Jul 25 12:09:18 CEST 2018
At first I was actually thinking about this situation, which cannot work:|
data.frame(x = 1:3, y = list(1:2, 1:3, 1:4))
|But I had never thought about this:|
df$y <-list(1:2, 1:3, 1:4)|
And it actually makes sense. The final requirement here is that all
columns must have the same length!
I'm not sure though why one would need that. Why not use lists in that case?
Thanks!
Ivan
--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra
On 25/07/2018 11:56, Juan Telleria Ruiz de Aguirre wrote:
>> Just for my understanding:
>> Is a data.frame with list columns still a data.frame? Isn't it then a list?
> * A data.frame (or tibble) is a list of columns.
> * In which each column must be from the same data type, in this case list().
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list