I have a list of data frames with ID
and I would like to name the extract the ID
from the data frames and assign it to the name of the data frame the ID
is located in.
library(lubridate)
library(tidyverse)
date <- rep_len(seq(dmy("01-01-2010"), dmy("31-12-2013"), by = "days"),1000)
ID <- rep(c("A","B","C", "D", "E"), 100)
df <- data.frame(date = date,
x = runif(length(date), min = 60000, max = 80000),
y = runif(length(date), min = 800000, max = 900000),
ID)
df1 <- df %>% group_split(ID)
Here is an example using the image, where in [[1]]
I would like to rename it to A
and in [[2]]
I would like to rename it to B
: