0

I want to output text results of an SEM analysis as a image file. I've tried with gridExtra, and strargazer packages but it doesn't work. Simply copying it results in not very nice formatting when I paste it. Is the best way to simply take a screen shot or is there another method to create an image file using R?

stat
  • 1

1 Answers1

1

You have not provided complete information to reproduce your case. However I have taken some sample to text to be saved as an image file.

library(png) 

#create empty image of size 1000 px x 1000 px
h<-1000
w<-1000    

#open new file for output
png("out.png", width=w, height=h)
par(mar=c(0,0,0,0), xpd=NA, mgp=c(0,0,0), oma=c(0,0,0,0), ann=F)
plot.new()
plot.window(0:1, 0:1)

 #save output from your analysis
output<-"output text from your analysis"

#add text
text(.5,.5, output, cex=5, col=rgb(.2,.2,.2,.7))

#close image
dev.off()

You can replace the variable 'output' with your analysis and make sure it is printed as an image.

doctshind s
  • 380
  • 3
  • 13