[R] Running sweave automatically using cygwin
Raquel Rangel de Meireles Guimarães
raquelrguimadem at gmail.com
Thu Dec 23 02:17:04 CET 2010
Hi all,
Hope someone could help me.
I am trying to run automatically the conversion of an Rwn file to a tex
file.
I am using windows 7, and cygwin.
I tried to run automatically the Sweave.sh script, in its the most
recent version available at R webpage:
http://cran.r-project.org/contrib/extra/scripts/Sweave.sh
Unfortunately, I got this error message:
===========================
Raquel at Dell-Raquel-PC ~
$ cd /cygdrive/c/Users/Raquel/Desktop/test_max_planck/test-raquel
Raquel at Dell-Raquel-PC
/cygdrive/c/Users/Raquel/Desktop/test_max_planck/test-raquel
$ chmod +x Sweave.sh
Raquel at Dell-Raquel-PC
/cygdrive/c/Users/Raquel/Desktop/test_max_planck/test-raquel
$ ./Sweave.sh test-raquel.Rnw
Run Sweave and postprocess with LaTeX directly from the command line
./Sweave.sh: line 657: R: command not found
An error occured after the use of 'R'!
Quiting.
=========================================
I don't know what is the problem. Could you please help me? Below you
find my Rnw code and the data for running sweave.
Best regards,
Raquel
========================================
Rnw file
\documentclass[12pt,oneside,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage{amsthm,amsfonts,bm}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage{ae}
\usepackage[alf,bibjustif,recuo=1cm]{abntcite} %bibliografia da ABNT
\usepackage{setspace}
\usepackage[charter]{mathdesign}
\usepackage{graphicx}
\usepackage{Sweave}
\bibliographystyle{abnt-alf}
\onehalfspacing
\setlength\parskip{0.5cm} % espaçamento entre parágrafos
\title{MP 187: Statistical Models with missing values \\Final Test}
\author{Raquel Rangel de Meireles Guimarães}
\date{December, 2010}
\begin{document}
\maketitle
<<echo=false,results=hide>>=
if (require(xtable) == FALSE)
stop("Pacote xtable() necessário para rodar essa análise.")
options(digits=3)
@
In this test we were required to analyse data from IQ scores of 250
subjects, repeated after one month. A large part of the sample dropped
the second visit.
Using only the complete cases, estimate the parameters of the regression
line:
<<>>=
setwd("C:\\Users\\Raquel\\Desktop\\test_max_planck")
data<-read.table("IQ.txt")
attach(data)
@
I start here with a scatterplot of the two variables. It is easy to see
from the figure \ref{fig:scatter} that we have a censored
\begin{figure}[ht!]
\centering
<<echo=false,fig=true>>=
plot(data$IQ1,data$IQ2)
@
\caption{Scatterplot of the two measurements of the IQ score, in the
first and second visit.}
\label{fig:scatter}
\end{figure}
\end{document}
=====================================
Data file: IQ.txt
"IQ1" "IQ2"
"1" 114.71 NA
"2" 112.84 NA
"3" 184.88 NA
"4" 120.03 NA
"5" 67 85.28
"6" 75.12 64.24
"7" 104.87 NA
"8" 73.07 67.34
"9" 100.7 NA
"10" 129.79 NA
"11" 11.83 109.91
"12" 139.52 NA
"13" 130.74 NA
"14" 111.92 NA
"15" 83.45 106.15
"16" 80.33 19.14
"17" 80.85 146.93
"18" 65.63 89.09
"19" 152.95 NA
"20" 9.84 104.58
"21" 112.47 NA
"22" 92.14 NA
"23" 151.66 NA
"24" 168.06 NA
"25" 34.6 47.21
"26" 120.65 NA
"27" 112.47 NA
"28" 80.5 109.71
"29" 58.46 52.5
"30" 112.97 NA
"31" 75.95 55.53
"32" 58.59 123.95
"33" 147.19 NA
"34" 38.98 90.26
"35" 115.18 NA
"36" 98.93 NA
"37" 113.2 NA
"38" 144.42 NA
"39" 145.52 NA
"40" 134.97 NA
"41" 98.61 NA
"42" 98.23 NA
"43" 166.18 NA
"44" 43.75 95.76
"45" 77.07 99.5
"46" 112.2 NA
"47" -0.03 13.23
"48" 102.19 NA
"49" 70.98 74.52
"50" 80.48 26.61
"51" 102.87 NA
"52" 94.22 NA
"53" 60.33 52.95
"54" 54.09 95.25
"55" 60.81 87.87
"56" 106.98 NA
"57" 71.18 112.27
"58" 80.95 53
"59" 122.56 NA
"60" 74.22 41.55
"61" 109.73 NA
"62" 142.66 NA
"63" 95.39 NA
"64" 97.68 NA
"65" 114.37 NA
"66" 114.02 NA
"67" 87.39 NA
"68" 183.12 NA
"69" 88.39 NA
"70" 57.81 99.84
"71" 133.65 NA
"72" 78.16 30.84
"73" 80.52 82.42
"74" 107.02 NA
"75" 85.35 NA
"76" 84.35 NA
"77" 92.62 NA
"78" 45.62 100.89
"79" 79.53 102.13
"80" 85.11 NA
"81" 108.72 NA
"82" 95.55 NA
"83" 57.17 52.48
"84" 106.16 NA
"85" 72.3 109.69
"86" 88.13 NA
"87" 117.57 NA
"88" 86.59 NA
"89" 65.56 71.14
"90" 97.76 NA
"91" 81.91 85.55
"92" 65.58 78.26
"93" 109.13 NA
"94" 92.55 NA
"95" 112.54 NA
"96" 66.77 106.92
"97" 106.69 NA
"98" 43.65 56.27
"99" 13.29 14.43
"100" 108.6 NA
"101" 111.95 NA
"102" 62.04 25.49
"103" 113.79 NA
"104" 125.43 NA
"105" 68.13 85.19
"106" 112.13 NA
"107" 21.61 83.67
"108" 49.13 132.66
"109" 104.61 NA
"110" 105.9 NA
"111" 107.7 NA
"112" 157.83 NA
"113" 20.3 41.49
"114" 43.87 -7.62
"115" 130.19 NA
"116" 137.28 NA
"117" 62.99 128.23
"118" 97.71 NA
"119" 103.46 NA
"120" 90.81 NA
"121" 40.89 51
"122" 146.28 NA
"123" 136.18 NA
"124" 111.93 NA
"125" 84.19 51.3
"126" 105.01 NA
"127" 78.28 44.44
"128" 74.54 67.52
"129" 80.92 152.09
"130" 151.56 NA
"131" 30.4 147.39
"132" 62.99 97.48
"133" 111.86 NA
"134" 81.48 27.73
"135" 146.15 NA
"136" 67.1 102.68
"137" 143.29 NA
"138" 96.46 NA
"139" 68.32 111.41
"140" 99.3 NA
"141" 84.19 NA
"142" 81.72 125.93
"143" 96.15 NA
"144" 108.72 NA
"145" 90.13 NA
"146" 122.81 NA
"147" 105.8 NA
"148" 62.01 74.33
"149" 119.9 NA
"150" 106.85 NA
"151" 122.73 NA
"152" 165.65 NA
"153" 102.62 NA
"154" 104.4 NA
"155" 164.31 NA
"156" 131.4 NA
"157" 63.49 55.07
"158" 101.66 NA
"159" 78 112.99
"160" 123.43 NA
"161" 57.85 89.96
"162" 122.07 NA
"163" 73.16 96.74
"164" 82.56 80.55
"165" 83.13 127.28
"166" 96.86 NA
"167" 71 105.9
"168" 87.04 NA
"169" 111.32 NA
"170" 81.98 109.89
"171" 66.82 49.2
"172" 47.69 69.14
"173" 125.36 NA
"174" 102.1 NA
"175" 135.84 NA
"176" 113.58 NA
"177" 58.7 44.42
"178" 103.84 NA
"179" 136.15 NA
"180" 71.53 78.96
"181" 114.4 NA
"182" 123.94 NA
"183" 149.28 NA
"184" 137.63 NA
"185" 77.12 89.17
"186" 96.78 NA
"187" 124.7 NA
"188" 36.6 87.75
"189" 119.91 NA
"190" 98.61 NA
"191" 68.51 64.39
"192" 114.2 NA
"193" 14.52 103.93
"194" 140.32 NA
"195" 41.35 89.9
"196" 105.18 NA
"197" 51.7 46.25
"198" 128.1 NA
"199" 86.58 NA
"200" 105.8 NA
"201" 156.95 NA
"202" 116.36 NA
"203" 105.48 NA
"204" 31.71 78.27
"205" 99.88 NA
"206" 99.88 NA
"207" 44.45 61.91
"208" 124.56 NA
"209" 92.08 NA
"210" 174.38 NA
"211" 75.18 28.15
"212" 137.6 NA
"213" 133.73 NA
"214" 70.77 116
"215" 55.07 95.08
"216" 106.5 NA
"217" 122.68 NA
"218" 34.61 99.65
"219" 53.79 46.15
"220" 157.05 NA
"221" 36.79 109.09
"222" 97.73 NA
"223" 10.11 104.35
"224" 87.95 NA
"225" 72.36 163.16
"226" 57.72 113.36
"227" 62.33 26.95
"228" 122.27 NA
"229" 49.03 78.68
"230" 92.04 NA
"231" 69.14 137.36
"232" 29.93 138.28
"233" 60.21 128.74
"234" 124.81 NA
"235" 121.18 NA
"236" 106.76 NA
"237" 116.47 NA
"238" 59.32 86.54
"239" 95.38 NA
"240" 103.09 NA
"241" 80.5 77.09
"242" 56.99 76.54
"243" 45.43 53.26
"244" 114.7 NA
"245" 50.22 144.81
"246" 107.48 NA
"247" 165.26 NA
"248" 67.44 72.73
"249" 89.46 NA
"250" 88.88 NA
=======================================
--
Raquel Rangel de Meireles Guimarães
Doutoranda em Demografia
raquel at cedeplar.ufmg.br
http://ufmg.academia.edu/RaquelGuimaraes
Cedeplar - Centro de Desenvolvimento e Planejamento Regional
Faculdade de Ciências Econômicas, UFMG (http://www.cedeplar.ufmg.br)
More information about the R-help
mailing list