I have data from Jan 2021 - Feb 2022 (the names data like CARD_202101, CARD_202102, CARD_202103 until CARD_202202) each data contain variables:
- CIF
- Date
- Descriptions
How can I make function in R. so I just can have CIF and Date variables for all datasets from Jan 2021 - Feb2022
example:
CARD_202101 <- data.frame(CIF = c(1,2,3), Date = c('2021-01-01', '2021-01-
02','2021-01-01'), Descriptions = c("a", "b", "c"))
CARD_202102 <- data.frame(CIF = c(1,6,3), Date = c('2021-02-01', '2021-02-
02','2021-01-01'), Descriptions = c("a", "b", "c"))
....
CARD_202202 <- data.frame(CIF = c(4,2,3), Date = c('2022-02-01', '2022-02-
02','2022-02-01'), Descriptions = c("a", "b", "c"))
I just want each dataset just only contain CIF and Date Variables, like
CARD_202101 <- data.frame(CIF = c(1,2,3), Date = c('2021-01-01', '2021-01-
02','2021-01-01'))
CARD_202102 <- data.frame(CIF = c(1,6,3), Date = c('2021-02-01', '2021-02-
02','2021-01-01'))
....
CARD_202202 <- data.frame(CIF = c(4,2,3), Date = c('2022-02-01', '2022-02-
02','2022-02-01'))
I need looping through all dataset