JuanPablo
JuanPablo

Reputation: 24754

make a list of data.frame

I try to make a list of data.frame

l <- list()
l['one'] <- data.frame(a=1:10, b=11:20)

but, I get this message

Mensajes de aviso perdidos
In l["one"] <- data.frame(a = 1:10, b = 11:20) :
  número de items para para sustituir no es un múltiplo de la longitud del reemplazo

PD: sorry, but I get the message in spanish.

how I can create list of data frames ?

or, what structure is useful to group a set of data.frame with a identifier ?

Upvotes: 1

Views: 2172

Answers (1)

Miff
Miff

Reputation: 7941

You need the code:

l <- list()
l[['one']] <- data.frame(a=1:10, b=11:20)

As you've written it, the single [ is trying to allocate to a (sub) list rather than an element of the list.

Upvotes: 1

Related Questions