I think it would be helpful to see the data your working with in a reprex.
list in R of length 5 (each element represents a different city): inside each element there are 31 temperatures.
If you data is small enough (and pls make it smaller if you're dealing with a large dataset), you can do this with the dput
function, for example,
ex_list <- list(
city_a = data.frame(
date = 1:3,
temp = c(4,12,4)
),
city_b = data.frame(
date = 1:3,
temp = c(5,7,2)
)
)
dput(ex_list)
#> list(city_a = structure(list(date = 1:3, temp = c(4, 12, 4)), class = "data.frame", row.names = c(NA,
#> -3L)), city_b = structure(list(date = 1:3, temp = c(5, 7, 2)), class = "data.frame", row.names = c(NA,
#> -3L)))
Created on 2018-09-17 by the reprex package (v0.2.0.9000).
Note that the final list of code there replicate ex_list
,
ex_list <- list(city_a = structure(list(date = 1:3, temp = c(4, 12, 4)), class = "data.frame", row.names = c(NA,
-3L)), city_b = structure(list(date = 1:3, temp = c(5, 7, 2)), class = "data.frame", row.names = c(NA,
-3L)))
And here's a handy guide to making a reprex
(FAQ: What's a reproducible example (`reprex`) and how do I create one?)