0
$\begingroup$

I have a list of values stored in SortedLat, where SortedLat is a list of 74 sublists, and each sublist has its first element be a string. As you can see I am trying to create the first column for a table with these strings.

TableOfValues1 = Prepend[q, {"B1", "B2"}]
TableOfValues2 = 
 MapThread[
  Prepend, {TableOfValues1, {"", 
    Partition[Table[SortedLat[[m]][[1]], {m, 1, 74}], 1]}}]

B1,B2 are just lists of 74 numbers.

I realize the problem with the code is probably that

Partition[Table[SortedLat[[m]][[1]],{m,1,74}],1]}}]

gives me a list of 74 strings instead of 74 separate strings. Therefore it gives the error that the dimensions don't match. Is there a way to break up the list of 74 strings into 74 separate strings to make the table/grid work?

Thanks.

$\endgroup$
  • $\begingroup$ Is Prepend[SortedLat, {"", "B1", "B2"}] what TableOfValues2 should be? What is q? $\endgroup$ – Coolwater May 19 at 5:28
  • $\begingroup$ sorry for the confusion, The table is originally 74x2 without labels. Table of values 1 was actually what you wrote, since B1, B2 go on the top row of the table. Table of Values 2 is adding a column on the leftmost side of the table. q is just a list of 74 sublists, each sublist containing a pair of numbers. $\endgroup$ – Houndbobsaw May 19 at 5:43
  • $\begingroup$ Please provide also an example dataset. $\endgroup$ – Henrik Schumacher May 19 at 5:46
0
$\begingroup$

You can write

TableOfValues2 = Join[Prepend[SortedLat[[All, {1}]], {""}], TableOfValues1, 2]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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