I'm trying to code in such a way as to take advantage of scripting, as I regularly get output in this format and having to copy/paste it in Excel one by one is a real chore. However, I'm stuck when it comes to implementing the functions.
So, my data is in the following form:
Condition Sample1 Sample2 .... Sample n
T1        6.99    5.80    ....  n_1      
T2        2.05    3.04    ....  n_1      
T3        4.50    4.69    ....  n_1      
T4        4.71    5.22    ....  n_1      
T5        5.66    3.65    ....  n_1      
T6        9.76    2.89    ....  n_1      
I need to apply the following equation:  , where x is the individual entry and n is a coefficient, such that the full equation looks something like this:
, where x is the individual entry and n is a coefficient, such that the full equation looks something like this:
 .
. 
Basically, per column, I need to consider each element in sequence and multiply it by a sequential coefficient (odd numbers from 1: length Condition) to get the answer S, for each Sample. The size of my dataset will not change - it will always be T1:T6, what will change is Sample 1...n. Ideally the value of S will be appended at the bottom of the column, or saved in a separate dataset with reference to the sample that it belongs to.
I've tried a number of solutions, including transposing, but can't seem to wrap my head around it.
My current attempt at implementing a simpler function on a portion of the dataset yielded no success.
 for (i in 2:8){dT[7,i] <-
     ((1*dT[1,i])+(3*dT[2,i])+(5*dT[3,i])+(7*dT[4,i])+(9*dT[5,i]))+(11*dT[6,i])
 }
I think the right solution involves some kind of *apply but I'm completely clueless as to how to use those properly.
EDIT: Adding a reproducible example:
N   Condition   Sample A    Sample B    Sample C    Sample D
1   T1          91.323      78.758      70.298      66.765
3   T2          -3.737      -1.5        -7.744      -9.247
5   T3          5.205       4.533       2.284       2.178
7   T4          -0.486      -0.068      -1.386      -0.927
9   T5          0.337       -0.139      0.087       0.055
    S        -0.046296296   -0.123654391    0.394039047 0.445258425
 
     
     
    