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

turn a list of dataframes into a dataframe

$
0
0

I have made a list of dataframes by querying an SQL database. dput(list_df[1:5]) gives

DATA

list_df <- list("NOT FOUND",
structure(list(associated_gene = NA, refsnp_id = "rs778387354", 
               allele = "GTGCCCTGGACGTGGCCTCGAACCGCGTGCCCTGG/GTGCCCTGG", 
               chrom_start = 42692955L, chrom_end = 42692989L), row.names = 2L, 
               class = "data.frame"), 
structure(list(associated_gene = "", refsnp_id = "rs771507737", 
               allele = "AT/-", chrom_start = 42693404L, chrom_end = 42693405L), row.names = 2L, 
               class = "data.frame"), 
"NOT FOUND",
structure(list(associated_gene = "A4GALT", refsnp_id = "rs387906280", 
               allele = "GGGG/GGGGG", chrom_start = 42692923L, chrom_end = 42692926L),
               row.names = 1L, class = "data.frame"), 
structure(list(associated_gene = c(NA, NA), refsnp_id = c("rs1296945362", 
               "rs775626055"), allele = c("GGGTGGGGTGGGG/GGGTGGGGTGGGGTGGGG", 
               "GGGGGG/GGGG/GGGGGGG"), chrom_start = c(42693742L, 42693751L),
               chrom_end = c(42693754L, 42693756L)), row.names = c(1L, 4L),
               class = "data.frame"))

The objects of list_df are of 3 dimension types:

1 5
2 5
NULL

I would like to bind list_df dataframes with only 1 row and 5 cols to a new dataframe, new_df such that new_df[i,] == list[i]

For objects with 0 row or more than 1 row, NA would do.


Viewing all articles
Browse latest Browse all 205491

Trending Articles



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