Using the forest.robu function from the robumeta
package. Trying pdf(filename="test.pdf",width=20,height=8)
suggested here did result in the error "unused argument filename". Any idea how I could make a plot from this function that does not fit the plot window fit in an output file? Thank you!
Asked
Active
Viewed 109 times
0

Hedwig
- 1
- 1
-
1As the error message says, `pdf()` has no argument called `filename`. Have you tried `pdf(file="test.pdf",width=20,height=8)`? – stefan Sep 10 '22 at 08:12
-
Yes, I saw that in the description of the function, but using pdf(file="test.pdf",width=20,height=8) results in a pdf file that is not readable. Could it be related to the issue that I don't seem to feed the object (plot) to the pdf? – Hedwig Sep 10 '22 at 08:59
-
Greetings! Usually it is helpful to provide a minimally reproducible dataset for questions here. One way of doing this is by using the `dput` function. You can find out how to use it here: https://youtu.be/3EID3P1oisg – Shawn Hemelstrand Sep 11 '22 at 06:58
1 Answers
0
I'm guessing that you don't yet understand how R graphics devices are used. One needs to set a particular output device up and then print
to it with one of the three graphics paradigms and then execute dev.off()
to finish the process. Failing to execute dev.off() with ps or pdf or png will start a file but then it doesn't get finish and will be unreadable. I'm guessing that forest.robu
constructs an object using either ggplot or lattice function calls, so do this:
?pdf; ?Devices; ?pdf.options # the help pages have further useful links
pdf(file= "My_grph.pdf", width=20, height=8)
gobj <- forest.robu( ..... whatever ...)
print(gobj)
dev.off()
If on the other hand, forest.robu()
uses base-graphics plotting, then the print
call is unneeded and might even cause problems so leave it out.

IRTFM
- 258,963
- 21
- 364
- 487
-
Great, yes, I had not understood how the R graphics devices work, but do now. Thank you for your help. – Hedwig Sep 11 '22 at 02:13