As  suggested I switched over to sweave.  Not to bore you with the details
but I have a lot of .tex tables that I have already created that I was
previously inserting into my tex document (using \input).  The journal I
plan on submitting to eventually wants the final .tex file so I thought it
would be a good idea to use Sweave, it makes a tex doc with my tables
generated and it should be all good.

I just spend a few hours trying to get the \SweaveInput commant to work
properly.  I finally determined that I couldn't put the file in as an
absolute path but it had to be a relative path.  I.e
\SweaveInput{/home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex}
gave the error:

R CMD Sweave hitmiss.Rnw
Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) :
  no Sweave file with name
'.//home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex'
found
Calls: <Anonymous> -> Sweave -> SweaveReadFile -> SweaveReadFile
Execution halted
make: *** [hitmiss.tex] Error 1

However, when i use:
\SweaveInput{../../../../../../../../home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex}
It works fine.

What am I missing here?
Thanks.


On Fri, Oct 28, 2011 at 11:48 AM, Duncan Murdoch
<murdoch.dun...@gmail.com>wrote:

> On 28/10/2011 2:40 PM, Trevor Davies wrote:
>
>> I have found that I like having my captions and labels in my latex
>> document
>> rather than having them contained in my xtable output file (I haven't
>> fully
>> gone to sweave yet).
>>
>
> The remark in the parens is the problem here.  Use Sweave.
>
> Duncan Murdoch
>
>
>   I know I can do something like this by using the
>> 'only.contents' argument in xtable.  Unfortunately, the only.contents
>> argument also removes the \begin{tabular}{rrrrrr}&  \end{tabular} (in the
>> example below) of the table.    This means that I have to go look up each
>> table to determine the number of columns.
>>
>> Is there a more automated way that I am missing? i.e only.contents but
>> with
>> tabular headers (but not \begin{table})?
>> Thank you.
>>
>> CODE:
>>
>> ## Demonstrate include.rownames, include.colnames,
>> ## only.contents and add.to.row arguments
>> set.seed(2345)
>> res<- matrix(sample(0:9, size=6*9, replace=TRUE), ncol=6, nrow=9)
>> xres<- xtable(res)
>> digits(xres)<- rep(0, 7)
>> addtorow<- list()
>> addtorow$pos<- list()
>> addtorow$pos[[1]]<- c(0, 2)
>> addtorow$pos[[2]]<- 4
>> addtorow$command<- c('\vspace{2mm} \n', '\vspace{10mm} \n')
>> print(xres, add.to.row=addtorow, include.rownames=FALSE,
>> include.colnames=TRUE, only.contents=TRUE, hline.after=c(0, 0, 9, 9))
>>
>>
>> Output (only.contents=TRUE)
>> % latex table generated in R 2.13.2 by xtable 1.6-0 package
>> % Fri Oct 28 11:38:10 2011
>> 1&  2&  3&  4&  5&  6 \\
>>
>>   space{2mm}
>>  \hline
>> \hline
>> 1&  7&  6&  6&  5&  9 \\
>>   1&  1&  1&  5&  7&  7 \\
>>    space{2mm}
>> 7&  3&  9&  8&  0&  5 \\
>>   0&  0&  4&  1&  5&  2 \\
>>    space{10mm}
>> 4&  1&  8&  5&  7&  1 \\
>>   2&  4&  5&  9&  5&  4 \\
>>   6&  3&  3&  5&  5&  8 \\
>>   7&  6&  1&  0&  7&  6 \\
>>   4&  4&  8&  8&  3&  2 \\
>>
>>    \hline
>> \hline
>>
>> Output (only.contents=FALSE)
>>
>> % latex table generated in R 2.13.2 by xtable 1.6-0 package
>> % Fri Oct 28 11:39:23 2011
>> \begin{table}[ht]
>> \begin{center}
>> \begin{tabular}{rrrrrr}
>>  1&  2&  3&  4&  5&  6 \\
>>
>>   space{2mm}
>>  \hline
>> \hline
>> 1&  7&  6&  6&  5&  9 \\
>>   1&  1&  1&  5&  7&  7 \\
>>    space{2mm}
>> 7&  3&  9&  8&  0&  5 \\
>>   0&  0&  4&  1&  5&  2 \\
>>    space{10mm}
>> 4&  1&  8&  5&  7&  1 \\
>>   2&  4&  5&  9&  5&  4 \\
>>   6&  3&  3&  5&  5&  8 \\
>>   7&  6&  1&  0&  7&  6 \\
>>   4&  4&  8&  8&  3&  2 \\
>>
>>    \hline
>> \hline
>> \end{tabular}
>> \end{center}
>> \end{table}
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________**________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to