Skip to content

Instantly share code, notes, and snippets.

@SachaEpskamp
Created February 14, 2013 17:03
Show Gist options
  • Save SachaEpskamp/4954285 to your computer and use it in GitHub Desktop.
Save SachaEpskamp/4954285 to your computer and use it in GitHub Desktop.
Slide 3 does not produce a plot. If I comment slide 1 out, it does!
\documentclass{beamer}
\begin{document}
<<echo=FALSE>>=
library("qgraph")
@
%%% SLIDE 1 %%%
\begin{frame}[fragile]{Weights matrices}
\begin{columns}
\begin{column}{5cm}
<<exCode,tidy=FALSE>>=
input <- matrix(c(
0,1,1,
0,0,1,
0,0,0),3,3,byrow=TRUE)
print(input)
@
\end{column}
\begin{column}{5cm}
\begin{center}
<<ex1plot>>=
qgraph(input)
@
\end{center}
\end{column}
\end{columns}
\end{frame}
%%% SLIDE 2 %%%
\begin{frame}[fragile]{Edgelists}
\begin{columns}
\begin{column}{5cm}
<<tidy=FALSE,fig.keep='none'>>=
E <- matrix(c(
1,2,
1,3,
2,3),ncol=2,byrow=TRUE)
print(E)
@
\end{column}
\begin{column}{5cm}
\begin{center}
<<edgelist1>>=
qgraph(E)
@
\end{center}
\end{column}
\end{columns}
\end{frame}
%%% SLIDE 3 %%%
\begin{frame}[fragile]{Edgelists}
\begin{columns}
\begin{column}{5cm}
<<tidy=FALSE,fig.keep='none'>>=
E <- data.frame(
from = c(1,1,2),
to = c(2,3,3))
print(E)
@
\end{column}
\begin{column}{5cm}
\begin{center}
<<edgelist2,include=TRUE>>=
qgraph(E)
@
\end{center}
\end{column}
\end{columns}
\end{frame}
%%% SLIDE 4 %%%
\begin{frame}[fragile]{Edgelists}
\begin{columns}
\begin{column}{5cm}
<<tidy=FALSE,fig.keep='none'>>=
E <- data.frame(
from = c(1,1,2),
to = c(2,3,3))
print(E)
@
\end{column}
\begin{column}{5cm}
\begin{center}
<<edgelist3>>=
qgraph(E,nNodes=4)
@
\end{center}
\end{column}
\end{columns}
\end{frame}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment