I have a list of dataframes and the name of each list has information that needs to be carried through to a column (I am going to bind all the dataframes). Is there a way to take this list name and make it a label in a column?
If the list starts out looking like this with head(my_list)
$day0005
# A tibble: 24 x 4
TSOIL1 lon lat TIME
<dbl> <dbl> <dbl> <dbl>
1 265 -95.8 45.7 0
2 265 -95.8 45.7 60.0
3 265 -95.8 45.7 120
4 265 -95.8 45.7 180
5 265 -95.8 45.7 240
I would like each to look like
$day0005
# A tibble: 24 x 4
TSOIL1 lon lat TIME day
<dbl> <dbl> <dbl> <dbl> day0005
1 265 -95.8 45.7 0 day0005
2 265 -95.8 45.7 60.0 day0005
3 265 -95.8 45.7 120 day0005
4 265 -95.8 45.7 180 day0005
5 265 -95.8 45.7 240 day0005
If your data started in a list and, as a result, you are including "list" in your search terms, congratulations, you have come to the right question. The answer here is simple and awesome.
If you started out with a bunch of dataframes, you may also want to look at the question that is similar to this one. They will show you how to turn your bunch of dataframes into a list of dataframes. Then come back here for the simplest answer related to identifying and binding ALL the rows.