Stataq
Stataq

Reputation: 2307

how to name a object in the list

I tried to add a data.frame into a list. How can I keep the name of the new data in the list datalist1.

Here is what I did:

test <-  read.csv(paste0(file_dir,"test.CSV"),stringsAsFactors = FALSE, header = TRUE)

datalist2<- c(list(test),datalist1)

However the new data test did not show up as test in datalist2. what should I do?

enter image description here

Upvotes: 0

Views: 26

Answers (1)

akrun
akrun

Reputation: 887961

We can use dplyr::lst

 library(dplyr)
 c(lst(test), datalist1)

Upvotes: 1

Related Questions