Guest User

Untitled

a guest
Apr 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Dataset Samples
  2. 1 WGS nrow(WGS.ped)
  3. 2 WES nrow(WES.ped.exp)
  4. 3 MIPS nrow(MIPS.ped.exp)
  5.  
  6. ldply(list(WGS=WGS.ped, WES=WES.ped.exp, MIPS=mips.ped.exp),
  7. function(l)(Samples=nrow(l)))
  8.  
  9. .id V1
  10. 1 WGS 3908
  11. 2 WES 26367
  12. 3 MIPS 14193
  13.  
  14. ldply(list(WGS=WGS.ped, WES=WES.ped.exp, MIPS=mips.ped.exp), nrow)
  15.  
  16. .id V1
  17. 1 WGS 3908
  18. 2 WES 26367
  19. 3 MIPS 14193
  20.  
  21. lapply(list(WGS=WGS.ped, WES=WES.ped.exp, MIPS=mips.ped.exp), nrow) %>%
  22. as.data.frame
  23.  
  24. WGS WES MIPS
  25. 1 3908 26367 14193
  26.  
  27. sapply(list(WGS=WGS.ped, WES=WES.ped.exp, MIPS=mips.ped.exp), nrow) %>%
  28. stack()
  29.  
  30. values ind
  31. 1 3908 WGS
  32. 2 26367 WES
  33. 3 14193 MIPS
  34.  
  35. map(list(WGS=WGS.ped, WES=WES.ped.exp, MIPS=mips.ped.exp), nrow) %>%
  36. as.data.frame()
  37.  
  38. WGS WES MIPS
  39. 3908 26367 14193
  40.  
  41. Dataset Samples
  42. WGS nrow(WGS.ped)
  43. WES nrow(WES.ped.exp)
  44. MIPS nrow(MIPS.ped.exp)
  45.  
  46. # Load some built-in dataframes to use as an example
  47. df1 <- mtcars
  48. df2 <- iris
  49. df3 <- PlantGrowth
  50.  
  51. # Build list of dataframes; use "=" so each element will be named
  52. df_list <- list(df1 = df1,
  53. df2 = df2,
  54. df3 = df3)
  55.  
  56. # Calculate number of rows in each dataframe
  57. nrows_list <- map(df_list, nrow)
  58.  
  59. # Create summary dataframe
  60. summary_df <- tibble(df = names(df_list),
  61. nrows = unlist(nrows_list))
  62.  
  63. # Output
  64. # A tibble: 3 x 2
  65. df nrows
  66. <chr> <int>
  67. 1 df1 32
  68. 2 df2 150
  69. 3 df3 30
Add Comment
Please, Sign In to add comment