0
str(txt_files_df)
List of 941
 $ :'data.frame':   19 obs. of  2 variables:
  ..$ V1: num [1:19] -2.87 4.83 21.33 25.73 32.33 ...
  ..$ V2: num [1:19] 8274 8274 8279 8281 8286 ...
 $ :'data.frame':   19 obs. of  2 variables:
  ..$ V1: num [1:19] -1.8 9.2 20.2 25.7 37.8 ...
  ..$ V2: num [1:19] 7199 7199 7200 7202 7213 ...

This is the file that I have that basically has V1 as the x values and V2 as the y values that plot a polygon each. I have 941 sets of those and I would like to know if there is a way to combine all X values into one column and all Y value into another to become one singular large matrix. The merge function doesn't allow me to use it since they are not in the correct format but I do not know which function I should use instead. Thank you!

  • 2
    "a way to combine all X values into one column and all Y value into another to become one singular large matrix." Why do you want this? Can't you just do `data.table::rbindlist(txt_files_df, idcol = TRUE)`? But, why do you want this? – Roland Aug 16 '21 at 14:12
  • I'm trying to do this so I can put the data into a certain function that I'm trying to use which has very specific measures. But thank you so much since this is exactly what I needed! – TreausreDragon Aug 16 '21 at 14:36
  • Have you tried `as.matrix(dplyr::bind_rows(txt_files_df))`? – FightMilk Aug 16 '21 at 14:57
  • You have also `do.call(rbind, txt_files_df)` that could work – Paul Aug 16 '21 at 15:01
  • Does this answer your question? [Recombining a list of Data.frames into a single data frame](https://stackoverflow.com/questions/2392915/recombining-a-list-of-data-frames-into-a-single-data-frame) – Paul Aug 16 '21 at 15:05

0 Answers0