0
$\begingroup$

I have two sets of data with different dimensions. I would like to use the Table function to create data to fill the dimensions and append it to the set, so both sets have the same dimensions.

I would like to start from the last value and create various x values (up to 2500) while the y can stay the same. So that data2 {917, 2} matches the dimensions of data 1 {1337,2}. Any insight would be greatly appreciated.

Data is here: https://docs.google.com/spreadsheets/d/1Z-tVwtRmt6UD3v67eMO0e5lws8wwZ6G3hLaZJkETSK0/edit?usp=sharing

 In[1]:= data1 = 
  Import["/Users/julissavelasquez/Box/1_Harrison Lab/03_Formic \
Acid/Wodtke_2021_Fig4C/hyperthermal_dist.xlsx", "SkipLines" -> 2][[1]];

In[2]:= data2 = 
  Import["/Users/julissavelasquez/Box/1_Harrison Lab/03_Formic \
Acid/Wodtke_2021_Fig4C/thermal_dist.xlsx", "SkipLines" -> 2][[1]];

In[3]:= {Dimensions[data1], Dimensions[data2]}

Out[3]= {{1337, 2}, {917, 2}}

In[4]:= data2[[1 ;; 2]]

Out[4]= {{2.9895, 0.00054879}, {5.979, 0.00054814}}

In[5]:= data2[[-2 ;; -1]]

Out[5]= {{2487.29, 2.7924*10^-6}, {2490.28, 2.1354*10^-6}}

In[6]:= Table[data2, {i, 2490.28, 2500}]

Out[6]= If[25048064219406400976 === $SessionID, 
Out[6], Message[
MessageName[Syntax, "noinfoker"]]; Missing["NotAvailable"]; Null]
$\endgroup$
3
  • $\begingroup$ y can stay the same at 2.1354*10^-6? $\endgroup$
    – kglr
    Mar 8 at 23:01
  • 1
    $\begingroup$ Not entirely sure I grok how you want to fill in the missing data, but you might look into the PadRight/PadLeft or ArrayPad. $\endgroup$
    – lericr
    Mar 8 at 23:28
  • $\begingroup$ Most of the data in the column 4 is close to the axis as shown on the log scale to the right of this graphic. So "y can stay the same" is unclear as pointed out above. Do you want to scale the data for a comparison etc? $\endgroup$
    – Syed
    Mar 9 at 4:53

1 Answer 1

0
$\begingroup$

I am not sure what kind of elements you want to use to fill in the extra spots, so I will be using generic ones but it is easy to modify for your specific needs.

I am using the following toy model data sets:

data1 = RandomInteger[100, {1337, 2}];
data2 = RandomInteger[100, {917, 2}];

They do have the dimensions of the OP

{Dimensions[data1], Dimensions[data2]}

{{1337, 2}, {917, 2}}

Some -but definitely not an exhaustive list- ways of modifying data2 such that it matches the dimensions of data1:

  1. arreshape = ArrayReshape[data2, {1337, 2}, "xx"];

  2. padr = PadRight[data2, {1337, 2}, "xx"];

  3. padl = PadLeft[data2, {1337, 2}, "xx"];

  4. catenate = Catenate[{data2, ConstantArray[ "xx", {Dimensions[data1][[1]] - Dimensions[data2][[1]], 2}]}];

Checking the all the above have the dimensions of data1

arreshape // Dimensions
padr // Dimensions
padl // Dimensions
catenate // Dimensions

{1337, 2}

{1337, 2}

{1337, 2}

{1337, 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.