1

I need help. I managed to have r tables in APA style using papaja in r markdown. But I need to merge them into one big table(It is going to be sociodemographics).

Sorry If I am not being clear but my situation is something like in this picture.

It doesn't have to be done through papaja but it looks so simple because I have exact columns but I don't know why r doesn't let me merge them.

Scott Thompson
  • 22,629
  • 4
  • 32
  • 34
dplyr
  • 83
  • 5
  • 1
    Can you provide the code (or a minimal example) with which you created tables 1 and 2? This would make it much easier to write a helpful and instructive answer. – Marius Barth Sep 02 '22 at 08:14

1 Answers1

0

If you pass a list of consistently structured data.frames, apa_table() will merge them in one of two ways depending on the setting of merge_method. The following does what you are looking for, I believe.

papaja::apa_table(
  list(
    Head = head(cars, 3)
    , Tail = tail(cars, 3)
  )
  , merge_method = "indent"
)

In Markdown format the results looks as follows.

           speed   dist   
---------  ------  -------
Head                      
\ \ \ 1    4.00    2.00   
\ \ \ 2    4.00    10.00  
\ \ \ 3    7.00    4.00   
Tail                      
\ \ \ 48   24.00   93.00  
\ \ \ 49   24.00   120.00 
\ \ \ 50   25.00   85.00  

(\ are non-breaking spaces used to indent the contents of the first column. Note that merge_method = "table_spanner" only works in papaja documents.)

crsh
  • 1,699
  • 16
  • 33