I have a list of lists. There are large number of elements in the list (I am showing here just a minimal example). I want to extract elements $d$ and $e$ from the data. So, I have to count at what position $d$ and $e$ are.

Is there any efficient way to do this without counting positions of elements manually? Can we label these elements and use those labels instead of using their positions?

a = RandomReal[{1, 100}, 10];
b = RandomReal[{1, 100}, 10];
c = RandomReal[{1, 100}, 10];
d = RandomReal[{1, 100}, 10];
e = RandomReal[{1, 100}, 10];
f = RandomReal[{1, 100}, 10];
data = Table[{a[[i]], b[[i]], c[[i]], d[[i]], e[[i]], f[[i]]}, {i, 1, 10}];
data1 = data[[All, {5, 6}]];
  • 1
    $\begingroup$ Lookup Transpose. It allows a more compact treatment: data = Transpose @ { a, b, c, d, e, f }; is equivalent to your procedural Table statement. $\endgroup$
    – gwr
    Apr 9, 2017 at 10:35
  • 1
    $\begingroup$ It would be really nice, if you could maybe say why the answer given is not acceptable. Thank your very much for the effort. :) $\endgroup$
    – gwr
    Apr 17, 2017 at 17:31

1 Answer 1


Make use of Association or Dataset:

data = Query[Transpose] @ AssociationThread[
    CharacterRange["a", "f"] -> {a, b, c, d, e, f}

data // Dataset

Dataset presentation of labeled data


In case you wonder: Using Transpose on the Association created by AssociationThread will not work directly. Nesting the Transpose in Query will make use of AssociationTranspose which is contained in the GeneralUtilities package:

Query[ Transpose ] // Normal



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.