1
Suppose n dataframes within a list. Each of these dataframes has different lines. For example, in a dataframe, rownames
are characters (make of cars) and in other, rownames
These are hospital registration numbers.
My goal is to transfer each of these rownames
into their respective dataframe, as a variable, and into the list. This is:
dados$newvariable<-rownames(dados)
not interesting, because I have to type this for each dataframe.
dput
to assist resolution:
list(structure(list(modelo = structure(1:5, .Label = c("a", "b",
"c", "d", "e"), class = "factor"), valor = c(5000, 10000, 15000,
20000, 25000)), .Names = c("modelo", "valor"), row.names = c("Fiat",
"Chevrolet", "Volkswagen", "Renault", "Ford"), class = "data.frame"),
structure(list(convenio = structure(1:6, .Label = c("a",
"b", "c", "d", "e", "f"), class = "factor"), valor = c(150,
300, 450, 600, 750, 900)), .Names = c("convenio", "valor"
), row.names = c("17242", "60003", "50215", "54345", "11246",
"45432"), class = "data.frame"))