[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Including multiple plots resulting from a loop of R code in LaTe
From: |
Eric Schulte |
Subject: |
Re: [O] Including multiple plots resulting from a loop of R code in LaTeX |
Date: |
Thu, 23 Aug 2012 10:43:10 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
John Hendy <address@hidden> writes:
> I'm conducting some neural network analysis, and the results are
> highly dependent on the random seed set prior to creating the model. I
> loop through seeds 1-500, storing the predicted values in one data
> frame and a table of mean sum of squared errors in another table.
>
> Then, I use ggplot to create only the 10 or so plots with the lowest
> error. The loop is something like this:
>
> ----------
> for(i in 1:10) {
>
> filename <- paste("neuralnet-","-seed-",as.character(mse[i,1]),".pdf", sep="")
>
> pdf(filename, width=12, height=8)
>
> [ggplot code]
>
> dev.off()
> ----------
>
> What I want to know is how to include the resultant files in LaTeX
> export. Since my model runs and then sorts by error, I don't know
> which seeds produce the best files beforehand, so I'd have to look at
> the error table and manually insert the plot names by hand. Changing
> results means changing file names by hand again.
>
> Any suggestions for things like this where the output of a babel block
> is not a single file?
>
Have you tried using header arguments like the following.
:results output raw :exports results
and then printing the file names (including the Org-mode link syntax) to
STDOUT from within your R code block.
If I understand correctly that should result in the behavior you're
after.
Best,
>
>
> Thanks,
> John
>
--
Eric Schulte
http://cs.unm.edu/~eschulte