Le ven. 23 mai ? 09:37, mohamed nur anisah a ?crit :
> Dear all,
>
> i have 2 lists of data with each of the list contain 14 columns.
No, you have one list with two elements; each is a 14-column data frame.
> How am i going to extract column 12 and 13 from each of the list ??
Let's call your list 'x'. Then
lapply(x, "[", c(12, 13))
or, better yet,
lapply(x, "[", c("breakp.start", "breakp.end"))
if I counted your columns correctly.
> and can i combine my extracted columns to form a single list.
You mean a single data frame? Given that the number of rows is not the
same in both elements, no. If they were, using sapply() instead of
lapply() would do the trick.
HTH Vincent
> Attach with are my data. Your coorperation is highly appreciated.
> Many thanks
>
> Regards,
> Anisah
>
> [[1]]
> CS(O) id no.anchor ref loc.start loc.end CS(O).size
> CS(O)ref.density tested loc.start loc.end breakp.start breakp.end
> den of anchor
> 1 CS 2.0 3 mmu19 6465196 6978022
> 512826 6 cfa18 55567952 55782336 6978022
> 6992734 28
> 2 CS 3.0 57 mmu19 6992734 10249966
> 3257232 17 cfa18 55792632 57688808 10249966
> 10277430 25
> 3 CS 4.0 21 mmu19 10277430 10955201
> 677771 31 cfa18 57721864 58419812 10955201
> 11008526 36
> 4 CS 5.0 2 mmu19 11008526 11045352
> 36826 54 cfa18 58462088 58518608 11045352
> 11316865 32
> 5 CS 6.0 7 mmu19 11316865 11814604
> 497739 14 cfa21 53902028 53514536 11814604
> 11937228 37
> 6 CS 7.0 14 mmu19 11937228 13847633
> 1910405 7 cfa18 40111560 41204940 13847633
> 14515091 17
> 7 CS 8.0 3 mmu19 14515091 16022770
> 1507679 2 cfa1 82195232 83511824 16022770
> 16199850 5
> 8 CS 9.0 25 mmu19 16199850 23625856
> 7426006 3 cfa1 83903856 90638880 23625856
> 23754554 14
> 9 CS 10.0 33 mmu19 23754554 29676192
> 5921638 6 cfa1 90773872 96913624 29676192
> 29763918 16
> 10 CS 11.0 6 mmu19 29763918 30164446
> 400528 15 cfa11 29919668 30510776 30164446
> 30611872 8
> 11 CS 12.0 19 mmu19 30611872 34558312
> 3946440 5 cfa26 38767664 41958808 34558312
> 34734404 15
> 12 CSO 13.1 73 mmu19 34734404 44009616
> 9275212 8 cfa28 7343952 15872122 44009616
> 44088256 21
> 13 CSO 13.2 71 mmu19 44088256 53582632
> 9494376 7 cfa28 15923283 24830712 53582632
> 53654796 14
>
> [[2]]
> CS(O) id no.anchor ref loc.start loc.end CS(O).size
> CS(O)ref.density tested loc.start loc.end breakp.start breakp.end
> den of anchor
> 1 CSO 2.1 4 mmuX 7311438 7428353
> 116915 34 cfaX 41732964 41660008 7428353
> 8356932 16
> 2 CSO 2.2 41 mmuX 8356932 20225456
> 11868524 3 cfaX 32299338 41540632 20225456
> 20641584 13
> 3 CSO 2.3 8 mmuX 20641584 33046200
> 12404616 1 cfaX 91770240 94412912 33046200
> 33175188 15
> 4 CSO 3.1 73 mmuX 33175188 57970280
> 24795092 3 cfaX 94538728 114133200 57970280
> 64939220 3
> 5 CSO 3.2 29 mmuX 64939220 70011280
> 5072060 6 cfaX 119319152 124625688 70011280
> 70039784 32
> 6 CS 4.0 21 mmuX 70039784 70677328
> 637544 33 cfaX 124652504 125280776 70677328
> 71241272 29
> 7 CSO 5.1 2 mmuX 71241272 71362456
> 121184 17 cfaX 125764816 125872960 71362456
> 71425576 14
> 8 CSO 6.1 4 mmuX 71425576 71824776
> 399200 10 cfaX 125917392 126261784 71824776
> 73894168 6
> 9 CSO 6.2 2 mmuX 73894168 74014744
> 120576 17 cfaX 6363930 1898656 74014744
> 74705408 11
> 10 CSO 6.3 17 mmuX 74705408 90487648
> 15782240 1 cfaX 32034930 19573208 90487648
> 91228160 10
> 11 CSO 6.4 49 mmuX 91228160 101058192
> 9830032 5 cfaX 51733740 61930260 101058192
> 101967264 9
> 12 CS 7.0 3 mmuX 101967264 102176888
> 209624 14 cfaX 62797768 63194052 102176888
> 102230040 11
> 13 CSO 8.1 2 mmuX 102230040 102409592
> 179552 11 cfaX 63307688 63460248 102409592
> 103123352 9
> 14 CSO 8.2 16 mmuX 103123352 110591464
> 7468112 2 cfaX 63896752 71000280 110591464
> 116044144 2
> 15 CS 9.0 2 mmuX 116044144 116407200
> 363056 6 cfaX 71543016 71752808 116407200
> 118512328 1
> 16 CS 10.0 24 mmuX 118512328 131185424
> 12673096 2 cfaX 72291072 79468544 131185424
> 131616688 20
> 17 CS 11.0 8 mmuX 131616688 132395992
> 779304 10 cfaX 79821128 80586408 132395992
> 132461760 17
> 18 CS 12.0 21 mmuX 132461760 137564368
> 5102608 4 cfaX 80674704 85936464 137564368
> 137927776 12
> 19 CSO 13.1 14 mmuX 137927776 142716752
> 4788976 3 cfaX 86288848 90933784 142716752
> 145888160 5
> 20 CSO 13.2 16 mmuX 145888160 147685360
> 1797200 9 cfaX 46726104 44854128 148377392
> 148480704 12
> 21 CS 14.0 3 mmuX 148480704 148838944
> 358240 8 cfaX 47357568 47895460 148838944
> 150553856 7
> 22 CS 15.0 12 mmuX 150553856 154876816
> 4322960 3 cfaX 19415076 15808253 154876816
> 154971520 8
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.