Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Save a data.frame of a list as a csv file in R

$
0
0

I have an object named output that is of class data.framecontaining a list. I was wondering if it might be possible to save output as a csv file from R?

Here is my code:

d <- data.frame(list(A = c(kap = 2, sap = 3), B = c(kap = 1, sap = 4)))

d[] <- lapply(d, as.list)  ## This step is required to show `TRUE` and `FALSE` in `output`

output <- data.frame(t(d), dap = c(T, F))

write.csv(output, "output.csv") # Error: unimplemented type 'list' in 'EncodeElement'

Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>