I am new to using Sweave with Latex, and am having some small troubles. Here is the segment of the document put into it's own tex file.
\documentclass[a4paper,10pt]{article}
\usepackage[dvips]{graphicx}
\usepackage{Sweave}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% END PREAMBLE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{plain}
\begin{figure}
\begin{center}
<<fig=TRUE,echo=FALSE>>=
data=read.table("adult_dataset/adult.data", sep=",");
age=c(t(data[1]));
fnlwgt=c(t(data[3]));
education_num=c(t(data[5]));
cap_gain=c(t(data[11]));
cap_loss=c(t(data[12]));
hrs_week=c(t(data[13]));
labels=c("Age", "Final weight", "Education num", "Capital gain", "Capital loss", "Hours per week");
dframe=data.frame(age, fnlwgt, education_num, cap_gain, cap_loss, hrs_week);
par(mfrow=c(2,3));
for (i in c(1:6) ){
boxplot(dframe[i], main=labels[i]);
}
@
\label{fig:boxplots}
\caption{Boxplots of numerical features}
\end{center}
\end{figure}
\end{document}
adult.data is http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data I compile with:
R CMD Sweave test.rnw && latex test.tex && dvipdf test.dvi
This produced a page which is开发者_高级运维 horizontal. It is the correct size, but it is rotated 90 degrees. Not the picture, but the whole page.
What can I do to fix this? Is this normal behavior?
Thank you for any suggestions :)
dvipdf -dAutoRotatePages=/None test.dvi
精彩评论