I wonder how to export the list above to csv or excel? I do not need to keep the data type, but having counts displayed next to Embase.n in a csv/Excel file would be very useful to me. Many thanks for helping me out.
Asked
Active
Viewed 412 times
0
-
Have you tried converting it to data frame (`as.data.frame(list)`) and then use `write.csv`? – Jonathan V. Solórzano Aug 29 '20 at 17:37
-
Maybe [this](https://stackoverflow.com/questions/27594541/export-a-list-into-a-csv-or-txt-file-in-r) could help you – Danielmagox Aug 29 '20 at 17:51
1 Answers
0
From what I see, your list seems to consist of one single value for each element. You can use Jonathan V. Solórzano's way to get a very wide table. Alternatively you can use unlist()
to collapse your list into a vector, and create a dataframe and export it.
mylist <- list(Embase.1 = 1, Embase.2 = 0, Embase.3 = 2)
v <- unlist(mylist)
df <- data.frame(Embase = v)
df
# Embase
#Embase.1 1
#Embase.2 0
#Embase.3 2
write.csv(df, row.names = F)

Ben Toh
- 742
- 5
- 9