title: Write multiple PDF object in one file using magick in R
body: <p>I am working to stick two PNGs side by side and then convert the concatenated object to a PDF using the code below. Now how can I write all the PDF objects as pages in a single file? I tried to save all the objects in a list and then pass the list to image_write(), but it did not work.</p>
  <pre><code>library(magick)
  vec_out &lt;- list()
  for(i in 1:length(all_stims)){
          stim &lt;- all_stims[i]
          img1 &lt;- image_read(file.path(figures_folder, &quot;across_cluster_heatmaps&quot;, paste0(&quot;bendall_&quot;,stim,&quot;.png&quot;)))
          img2 &lt;- image_read(file.path(figures_folder, &quot;across_cluster_heatmaps&quot;, paste0(&quot;farmer_&quot;, stim,&quot;.png&quot;)))
          imgs &lt;- c(img1, img2)
          imgs &lt;- image_append(imgs)
          imgs_pdf &lt;- image_convert(imgs)
          vec_out[[i]] &lt;- imgs_pdf
  }
  
  image_write(vec_out, path = file.path(figures_folder, &quot;test.pdf&quot;), format = &quot;pdf&quot;)
  </code></pre>
  <p>Any suggestions would be helpful. Thanks.</p>