Transpose the Dataset

Hi,
I need help to transpose this data from Example 1 into Example 2.
It is basically from row format into column format
Anyone could help me please?

-Example1-

site microform Mean_flux term estimate std.error p.value.x p.value.y adj.r.squared
1 SAB16 FP 0.857687931 (Intercept) -0.094062643 0.403996267 0.815961794 0.000995689 0.016921618
2 SAB16 FP 0.857687931 soilMoist -0.001972267 0.001203941 0.101839009 0.000995689 0.016921618
3 SAB16 FP 0.857687931 Tsoil 0.03591177 0.01331863 0.0071805 0.000995689 0.016921618
4 SAB16 HP 0.906484945 (Intercept) -0.595180863 0.561988308 0.289972009 3.67E-05 0.028470684
5 SAB16 HP 0.906484945 soilMoist -0.003065814 0.001274816 0.016460441 3.67E-05 0.028470684
6 SAB16 HP 0.906484945 Tsoil 0.056832904 0.018676565 0.002438548 3.67E-05 0.028470684

-Example2-

site microform Flux SoilMoist WTD Tsoil intercept p.value adj.r.squared
SAB16 FP 0.859189619 0.000386±0.0047 0.3486±0.3902 0.0001±0.0073 0.6328±0.2538 0.1605 0.003761364
SAB16 HP 0.869325688 -0.00199±0.0053 0.2296±0.4938 -0.0021±0.0091 0.8863±0.3009 0.0411 0.009661623

Hello,
have you tried function " t() "?
I hope this will help you ---How to transpose data frame in R - Data Cornering

What you have shown is not mere transposition.
for example in the 2nd table the value under Flux first row is 0.859189619, this is a unique number that does not appear exactly as such in the first table, hence you would have calculated it in some way. what way is that ?
similarly SoilMoist - 0.000386±0.0047 , etc...

I think your first table has 6row * 9col = 54 cells of information, and the 2nd table has 2row * 9col = 18 cells of content
further underlining that mere transposition, is not what is happening.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.