0

I am working with a large data set that is currently in list form. The data has differing lengths for all of the rows. How do I get this into a data frame without getting this error

"Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 114, 1, 734, 40"

I have tried using df <- data.frame(session) but i just keep getting the same error and don't know how to get around it.

I_O
  • 4,983
  • 2
  • 2
  • 15
  • 2
    Welcome to SO. You need to provide a bit more info (and ideally and [MRE](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)). It's a little unclear what you want the output to be. For example, the length of one part of your list is 734, and another is 1. A data frame in R needs to have the same number of rows in each column (it is a rectangle). So, do you want to fill all the missing values in? – Taren Sanders Jun 07 '23 at 05:26
  • To add some context, few words about the origin of that dataset would also be helpful. Is it from a number of CSV files that do not share the same structure? A ragged / irregular text file? If it happens to be a JSON, what ( kind of) service was generating it? – margusl Jun 07 '23 at 05:48
  • 1
    See: [How to convert a list consisting of vector of different lengths to a usable data frame in R?](https://stackoverflow.com/q/15201305/10488504) – GKi Jun 07 '23 at 07:26

0 Answers0