-3

I want to have this colum called lag to be into a row and then the value of acf stands under the corresponding value. in order words I want to turn it so it takes less place in my report?

enter image description here

I look forward to hear from you

best, Michael

Allan Cameron
  • 147,086
  • 7
  • 49
  • 87
The Wolf
  • 11
  • 2

1 Answers1

0

You can use this code:

df <- data.frame(lag = seq(0, 12, 1),
                 acf = c(1, 0.199, -0.018, -0.019, -0.012, 0.004, -0.038, -0.014, -0.07, -0.044, -0.016, 0.033, 0.061))

Output df:

   lag    acf
1    0  1.000
2    1  0.199
3    2 -0.018
4    3 -0.019
5    4 -0.012
6    5  0.004
7    6 -0.038
8    7 -0.014
9    8 -0.070
10   9 -0.044
11  10 -0.016
12  11  0.033
13  12  0.061

Use this code:

t(df)

Output t(df):

    [,1]  [,2]   [,3]   [,4]   [,5]  [,6]   [,7]   [,8]  [,9]  [,10]  [,11]  [,12]  [,13]
lag    0 1.000  2.000  3.000  4.000 5.000  6.000  7.000  8.00  9.000 10.000 11.000 12.000
acf    1 0.199 -0.018 -0.019 -0.012 0.004 -0.038 -0.014 -0.07 -0.044 -0.016  0.033  0.061
Quinten
  • 35,235
  • 5
  • 20
  • 53