Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

I simply use chunk with include=FALSE in this case.

Liviu


 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 1:38 PM, John Kane jrkrid...@yahoo.ca wrote:


 
 From: Yihui Xie x...@yihui.name
 To: John Kane jrkrid...@yahoo.ca
 Cc: Lyx List lyx-users@lists.lyx.org
 Sent: Monday, June 3, 2013 4:17:18 PM
 Subject: Re: Problem using R's table package with knitr.

 Did you \usepackage{booktabs} in the preamble? That is what
 ?tables::booktabs says.

 Yes , I tried it both with and without \usepackage{booktabs}

 I realise I did not attach my example file.

 Hopefully there is one now.

 Thanks

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the
 booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu


Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks Yihui.  I understood the invisible(booktabs()) after a bit of thought, 
but not Liviu's comment.  Using his approach,  could I run booktabs ina earlier 
chunk?





 From: Yihui Xie x...@yihui.name
To: Liviu Andronic landronim...@gmail.com 
Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org 
Sent: Tuesday, June 4, 2013 2:36:57 AM
Subject: Re: Problem using R's table package with knitr.
 

But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu

Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

Yes. You can do:
include=F=
booktabs()
@

Then
results='asis'=
latex(table(...))
@

From memory this works.
Liviu



 
 From: Yihui Xie x...@yihui.name
 To: Liviu Andronic landronim...@gmail.com
 Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org
 Sent: Tuesday, June 4, 2013 2:36:57 AM

 Subject: Re: Problem using R's table package with knitr.

 But John needs the LaTeX table output in the next line of R code;
 include=FALSE will exclude everything in that chunk.

 Moving booktabs() to the previous chunk and using include=FALSE there
 will be fine.

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com
 wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
That is right.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Tue, Jun 4, 2013 at 8:49 AM, Liviu Andronic landronim...@gmail.com wrote:
 On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

 Yes. You can do:
 include=F=
 booktabs()
 @

 Then
 results='asis'=
 latex(table(...))
 @

 From memory this works.
 Liviu


Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks.  I may be getting some glimmer of how all this holds together.  Now if 
I could just figure out what a chunk_option does I'm almost ready for kniter 
nursery school.







 From: Liviu Andronic landronim...@gmail.com
To: John Kane jrkrid...@yahoo.ca 
Cc: Yihui Xie x...@yihui.name; Lyx List lyx-users@lists.lyx.org 
Sent: Tuesday, June 4, 2013 11:49:06 AM
Subject: Re: Problem using R's table package with knitr.
 

On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

Yes. You can do:
include=F=
booktabs()
@

Then
results='asis'=
latex(table(...))
@

From memory this works.
Liviu



 
 From: Yihui Xie x...@yihui.name
 To: Liviu Andronic landronim...@gmail.com
 Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org
 Sent: Tuesday, June 4, 2013 2:36:57 AM

 Subject: Re: Problem using R's table package with knitr.

 But John needs the LaTeX table output in the next line of R code;
 include=FALSE will exclude everything in that chunk.

 Moving booktabs() to the previous chunk and using include=FALSE there
 will be fine.

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com
 wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

Re: Problem using R's table package with knitr.

2013-06-04 Thread Scott Kostyshak
On Tue, Jun 4, 2013 at 1:25 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks.  I may be getting some glimmer of how all this holds together.  Now
 if I could just figure out what a chunk_option does I'm almost ready for
 kniter nursery school.

See here:
http://yihui.name/knitr/options

And once you're ready for knitr graduate school, see here (don't let
Yihui's modesty fool you):
http://yihui.name/en/2013/06/tips-for-writing-an-r-book/

 Scott


Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

I simply use chunk with include=FALSE in this case.

Liviu


 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 1:38 PM, John Kane jrkrid...@yahoo.ca wrote:


 
 From: Yihui Xie x...@yihui.name
 To: John Kane jrkrid...@yahoo.ca
 Cc: Lyx List lyx-users@lists.lyx.org
 Sent: Monday, June 3, 2013 4:17:18 PM
 Subject: Re: Problem using R's table package with knitr.

 Did you \usepackage{booktabs} in the preamble? That is what
 ?tables::booktabs says.

 Yes , I tried it both with and without \usepackage{booktabs}

 I realise I did not attach my example file.

 Hopefully there is one now.

 Thanks

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the
 booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu


Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks Yihui.  I understood the invisible(booktabs()) after a bit of thought, 
but not Liviu's comment.  Using his approach,  could I run booktabs ina earlier 
chunk?





 From: Yihui Xie x...@yihui.name
To: Liviu Andronic landronim...@gmail.com 
Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org 
Sent: Tuesday, June 4, 2013 2:36:57 AM
Subject: Re: Problem using R's table package with knitr.
 

But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in 
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu

Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

Yes. You can do:
include=F=
booktabs()
@

Then
results='asis'=
latex(table(...))
@

From memory this works.
Liviu



 
 From: Yihui Xie x...@yihui.name
 To: Liviu Andronic landronim...@gmail.com
 Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org
 Sent: Tuesday, June 4, 2013 2:36:57 AM

 Subject: Re: Problem using R's table package with knitr.

 But John needs the LaTeX table output in the next line of R code;
 include=FALSE will exclude everything in that chunk.

 Moving booktabs() to the previous chunk and using include=FALSE there
 will be fine.

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com
 wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
That is right.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Tue, Jun 4, 2013 at 8:49 AM, Liviu Andronic landronim...@gmail.com wrote:
 On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

 Yes. You can do:
 include=F=
 booktabs()
 @

 Then
 results='asis'=
 latex(table(...))
 @

 From memory this works.
 Liviu


Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks.  I may be getting some glimmer of how all this holds together.  Now if 
I could just figure out what a chunk_option does I'm almost ready for kniter 
nursery school.







 From: Liviu Andronic landronim...@gmail.com
To: John Kane jrkrid...@yahoo.ca 
Cc: Yihui Xie x...@yihui.name; Lyx List lyx-users@lists.lyx.org 
Sent: Tuesday, June 4, 2013 11:49:06 AM
Subject: Re: Problem using R's table package with knitr.
 

On Tue, Jun 4, 2013 at 5:33 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
 thought, but not Liviu's comment.  Using his approach,  could I run booktabs
 ina earlier chunk?

Yes. You can do:
include=F=
booktabs()
@

Then
results='asis'=
latex(table(...))
@

From memory this works.
Liviu



 
 From: Yihui Xie x...@yihui.name
 To: Liviu Andronic landronim...@gmail.com
 Cc: John Kane jrkrid...@yahoo.ca; Lyx List lyx-users@lists.lyx.org
 Sent: Tuesday, June 4, 2013 2:36:57 AM

 Subject: Re: Problem using R's table package with knitr.

 But John needs the LaTeX table output in the next line of R code;
 include=FALSE will exclude everything in that chunk.

 Moving booktabs() to the previous chunk and using include=FALSE there
 will be fine.

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic landronim...@gmail.com
 wrote:
 On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie x...@yihui.name wrote:
 You should not print booktabs() in a chunk with results='asis',
 because that will generate invalid LaTeX code in the output. You can
 use invisible(booktabs()) or foo - booktabs() to avoid printing.

 Or request Duncan (the package author) to return invisible(save) in
 booktabs().

 I simply use chunk with include=FALSE in this case.

 Liviu





-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

Re: Problem using R's table package with knitr.

2013-06-04 Thread Scott Kostyshak
On Tue, Jun 4, 2013 at 1:25 PM, John Kane jrkrid...@yahoo.ca wrote:
 Thanks.  I may be getting some glimmer of how all this holds together.  Now
 if I could just figure out what a chunk_option does I'm almost ready for
 kniter nursery school.

See here:
http://yihui.name/knitr/options

And once you're ready for knitr graduate school, see here (don't let
Yihui's modesty fool you):
http://yihui.name/en/2013/06/tips-for-writing-an-r-book/

 Scott


Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie <x...@yihui.name> wrote:
> You should not print booktabs() in a chunk with results='asis',
> because that will generate invalid LaTeX code in the output. You can
> use invisible(booktabs()) or foo <- booktabs() to avoid printing.
>
> Or request Duncan (the package author) to return invisible(save) in 
> booktabs().
>
I simply use chunk with include=FALSE in this case.

Liviu


> Regards,
> Yihui
> --
> Yihui Xie <xieyi...@gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
>
>
> On Mon, Jun 3, 2013 at 1:38 PM, John Kane <jrkrid...@yahoo.ca> wrote:
>>
>>
>> 
>> From: Yihui Xie <x...@yihui.name>
>> To: John Kane <jrkrid...@yahoo.ca>
>> Cc: Lyx List <lyx-users@lists.lyx.org>
>> Sent: Monday, June 3, 2013 4:17:18 PM
>> Subject: Re: Problem using R's table package with knitr.
>>
>> Did you \usepackage{booktabs} in the preamble? That is what
>> ?tables::booktabs says.
>>
>> Yes , I tried it both with and without \usepackage{booktabs}
>>
>> I realise I did not attach my example file.
>>
>> Hopefully there is one now.
>>
>> Thanks
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyi...@gmail.com>
>> Phone: 515-294-2465 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 2215 Snedecor Hall, Ames, IA
>>
>>
>> On Mon, Jun 3, 2013 at 3:07 PM, John Kane <jrkrid...@yahoo.ca> wrote:
>>> I was having a look at the tables package in R and tried to run an example
>>> in LyX. It works fine until I try using the suggestion to use the
>>> booktabs()
>>> command in the knitr statement.
>>> The code works fine in R.
>>>
>>> I assume that I am in conflict with another latex package in LyX?  Any
>>> workarounds?
>>>
>>> It's not a serious problem as I don't actually need to use the tables
>>> package; I was just playing around with tables  trying to understand the
>>> syntax and decided to try it in LyX.
>>
>>



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic  wrote:
> On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie  wrote:
>> You should not print booktabs() in a chunk with results='asis',
>> because that will generate invalid LaTeX code in the output. You can
>> use invisible(booktabs()) or foo <- booktabs() to avoid printing.
>>
>> Or request Duncan (the package author) to return invisible(save) in 
>> booktabs().
>>
> I simply use chunk with include=FALSE in this case.
>
> Liviu


Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks Yihui.  I understood the invisible(booktabs()) after a bit of thought, 
but not Liviu's comment.  Using his approach,  could I run booktabs ina earlier 
chunk?





 From: Yihui Xie <x...@yihui.name>
To: Liviu Andronic <landronim...@gmail.com> 
Cc: John Kane <jrkrid...@yahoo.ca>; Lyx List <lyx-users@lists.lyx.org> 
Sent: Tuesday, June 4, 2013 2:36:57 AM
Subject: Re: Problem using R's table package with knitr.
 

But John needs the LaTeX table output in the next line of R code;
include=FALSE will exclude everything in that chunk.

Moving booktabs() to the previous chunk and using include=FALSE there
will be fine.

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 11:29 PM, Liviu Andronic <landronim...@gmail.com> wrote:
> On Mon, Jun 3, 2013 at 10:45 PM, Yihui Xie <x...@yihui.name> wrote:
>> You should not print booktabs() in a chunk with results='asis',
>> because that will generate invalid LaTeX code in the output. You can
>> use invisible(booktabs()) or foo <- booktabs() to avoid printing.
>>
>> Or request Duncan (the package author) to return invisible(save) in 
>> booktabs().
>>
> I simply use chunk with include=FALSE in this case.
>
> Liviu

Re: Problem using R's table package with knitr.

2013-06-04 Thread Liviu Andronic
On Tue, Jun 4, 2013 at 5:33 PM, John Kane  wrote:
> Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
> thought, but not Liviu's comment.  Using his approach,  could I run booktabs
> ina earlier chunk?
>
Yes. You can do:

Re: Problem using R's table package with knitr.

2013-06-04 Thread Yihui Xie
That is right.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Tue, Jun 4, 2013 at 8:49 AM, Liviu Andronic  wrote:
> On Tue, Jun 4, 2013 at 5:33 PM, John Kane  wrote:
>> Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
>> thought, but not Liviu's comment.  Using his approach,  could I run booktabs
>> ina earlier chunk?
>>
> Yes. You can do:
> 

Re: Problem using R's table package with knitr.

2013-06-04 Thread John Kane
Thanks.  I may be getting some glimmer of how all this holds together.  Now if 
I could just figure out what a chunk_option does I'm almost ready for kniter 
nursery school.







 From: Liviu Andronic <landronim...@gmail.com>
To: John Kane <jrkrid...@yahoo.ca> 
Cc: Yihui Xie <x...@yihui.name>; Lyx List <lyx-users@lists.lyx.org> 
Sent: Tuesday, June 4, 2013 11:49:06 AM
Subject: Re: Problem using R's table package with knitr.
 

On Tue, Jun 4, 2013 at 5:33 PM, John Kane <jrkrid...@yahoo.ca> wrote:
> Thanks Yihui.  I understood the invisible(booktabs()) after a bit of
> thought, but not Liviu's comment.  Using his approach,  could I run booktabs
> ina earlier chunk?
>
Yes. You can do:
<

Re: Problem using R's table package with knitr.

2013-06-04 Thread Scott Kostyshak
On Tue, Jun 4, 2013 at 1:25 PM, John Kane  wrote:
> Thanks.  I may be getting some glimmer of how all this holds together.  Now
> if I could just figure out what a chunk_option does I'm almost ready for
> kniter nursery school.

See here:
http://yihui.name/knitr/options

And once you're ready for knitr graduate school, see here (don't let
Yihui's modesty fool you):
http://yihui.name/en/2013/06/tips-for-writing-an-r-book/

 Scott


Problem using R's table package with knitr.

2013-06-03 Thread John Kane
I was having a look at the tables package in R and tried to run an example in 
LyX. It works fine until I try using the suggestion to use the booktabs() 
command in the knitr statement.  

The code works fine in R.  


I assume that I am in conflict with another latex package in LyX?  Any 
workarounds?  


It's not a serious problem as I don't actually need to use the tables package; 
I was just playing around with tables  trying to understand the syntax and 
decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread John Kane





 From: Yihui Xie x...@yihui.name
To: John Kane jrkrid...@yahoo.ca 
Cc: Lyx List lyx-users@lists.lyx.org 
Sent: Monday, June 3, 2013 4:17:18 PM
Subject: Re: Problem using R's table package with knitr.
 

Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Yes , I tried it both with and without  \usepackage{booktabs}

I realise I did not attach my example file.

Hopefully there is one now.

Thanks 

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.

tables.package.lyx
Description: application/lyx


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
You should not print booktabs() in a chunk with results='asis',
because that will generate invalid LaTeX code in the output. You can
use invisible(booktabs()) or foo - booktabs() to avoid printing.

Or request Duncan (the package author) to return invisible(save) in booktabs().

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 1:38 PM, John Kane jrkrid...@yahoo.ca wrote:


 
 From: Yihui Xie x...@yihui.name
 To: John Kane jrkrid...@yahoo.ca
 Cc: Lyx List lyx-users@lists.lyx.org
 Sent: Monday, June 3, 2013 4:17:18 PM
 Subject: Re: Problem using R's table package with knitr.

 Did you \usepackage{booktabs} in the preamble? That is what
 ?tables::booktabs says.

 Yes , I tried it both with and without \usepackage{booktabs}

 I realise I did not attach my example file.

 Hopefully there is one now.

 Thanks

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the
 booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.




Problem using R's table package with knitr.

2013-06-03 Thread John Kane
I was having a look at the tables package in R and tried to run an example in 
LyX. It works fine until I try using the suggestion to use the booktabs() 
command in the knitr statement.  

The code works fine in R.  


I assume that I am in conflict with another latex package in LyX?  Any 
workarounds?  


It's not a serious problem as I don't actually need to use the tables package; 
I was just playing around with tables  trying to understand the syntax and 
decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread John Kane





 From: Yihui Xie x...@yihui.name
To: John Kane jrkrid...@yahoo.ca 
Cc: Lyx List lyx-users@lists.lyx.org 
Sent: Monday, June 3, 2013 4:17:18 PM
Subject: Re: Problem using R's table package with knitr.
 

Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Yes , I tried it both with and without  \usepackage{booktabs}

I realise I did not attach my example file.

Hopefully there is one now.

Thanks 

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.

tables.package.lyx
Description: application/lyx


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
You should not print booktabs() in a chunk with results='asis',
because that will generate invalid LaTeX code in the output. You can
use invisible(booktabs()) or foo - booktabs() to avoid printing.

Or request Duncan (the package author) to return invisible(save) in booktabs().

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 1:38 PM, John Kane jrkrid...@yahoo.ca wrote:


 
 From: Yihui Xie x...@yihui.name
 To: John Kane jrkrid...@yahoo.ca
 Cc: Lyx List lyx-users@lists.lyx.org
 Sent: Monday, June 3, 2013 4:17:18 PM
 Subject: Re: Problem using R's table package with knitr.

 Did you \usepackage{booktabs} in the preamble? That is what
 ?tables::booktabs says.

 Yes , I tried it both with and without \usepackage{booktabs}

 I realise I did not attach my example file.

 Hopefully there is one now.

 Thanks

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


 On Mon, Jun 3, 2013 at 3:07 PM, John Kane jrkrid...@yahoo.ca wrote:
 I was having a look at the tables package in R and tried to run an example
 in LyX. It works fine until I try using the suggestion to use the
 booktabs()
 command in the knitr statement.
 The code works fine in R.

 I assume that I am in conflict with another latex package in LyX?  Any
 workarounds?

 It's not a serious problem as I don't actually need to use the tables
 package; I was just playing around with tables  trying to understand the
 syntax and decided to try it in LyX.




Problem using R's table package with knitr.

2013-06-03 Thread John Kane
I was having a look at the tables package in R and tried to run an example in 
LyX. It works fine until I try using the suggestion to use the booktabs() 
command in the knitr statement.  

The code works fine in R.  


I assume that I am in conflict with another latex package in LyX?  Any 
workarounds?  


It's not a serious problem as I don't actually need to use the tables package; 
I was just playing around with tables  trying to understand the syntax and 
decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane  wrote:
> I was having a look at the tables package in R and tried to run an example
> in LyX. It works fine until I try using the suggestion to use the booktabs()
> command in the knitr statement.
> The code works fine in R.
>
> I assume that I am in conflict with another latex package in LyX?  Any
> workarounds?
>
> It's not a serious problem as I don't actually need to use the tables
> package; I was just playing around with tables  trying to understand the
> syntax and decided to try it in LyX.


Re: Problem using R's table package with knitr.

2013-06-03 Thread John Kane





 From: Yihui Xie <x...@yihui.name>
To: John Kane <jrkrid...@yahoo.ca> 
Cc: Lyx List <lyx-users@lists.lyx.org> 
Sent: Monday, June 3, 2013 4:17:18 PM
Subject: Re: Problem using R's table package with knitr.
 

Did you \usepackage{booktabs} in the preamble? That is what
?tables::booktabs says.

Yes , I tried it both with and without  \usepackage{booktabs}

I realise I did not attach my example file.

Hopefully there is one now.

Thanks 

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 3:07 PM, John Kane <jrkrid...@yahoo.ca> wrote:
> I was having a look at the tables package in R and tried to run an example
> in LyX. It works fine until I try using the suggestion to use the booktabs()
> command in the knitr statement.
> The code works fine in R.
>
> I assume that I am in conflict with another latex package in LyX?  Any
> workarounds?
>
> It's not a serious problem as I don't actually need to use the tables
> package; I was just playing around with tables  trying to understand the
> syntax and decided to try it in LyX.

tables.package.lyx
Description: application/lyx


Re: Problem using R's table package with knitr.

2013-06-03 Thread Yihui Xie
You should not print booktabs() in a chunk with results='asis',
because that will generate invalid LaTeX code in the output. You can
use invisible(booktabs()) or foo <- booktabs() to avoid printing.

Or request Duncan (the package author) to return invisible(save) in booktabs().

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Jun 3, 2013 at 1:38 PM, John Kane <jrkrid...@yahoo.ca> wrote:
>
>
> 
> From: Yihui Xie <x...@yihui.name>
> To: John Kane <jrkrid...@yahoo.ca>
> Cc: Lyx List <lyx-users@lists.lyx.org>
> Sent: Monday, June 3, 2013 4:17:18 PM
> Subject: Re: Problem using R's table package with knitr.
>
> Did you \usepackage{booktabs} in the preamble? That is what
> ?tables::booktabs says.
>
> Yes , I tried it both with and without \usepackage{booktabs}
>
> I realise I did not attach my example file.
>
> Hopefully there is one now.
>
> Thanks
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyi...@gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
>
>
> On Mon, Jun 3, 2013 at 3:07 PM, John Kane <jrkrid...@yahoo.ca> wrote:
>> I was having a look at the tables package in R and tried to run an example
>> in LyX. It works fine until I try using the suggestion to use the
>> booktabs()
>> command in the knitr statement.
>> The code works fine in R.
>>
>> I assume that I am in conflict with another latex package in LyX?  Any
>> workarounds?
>>
>> It's not a serious problem as I don't actually need to use the tables
>> package; I was just playing around with tables  trying to understand the
>> syntax and decided to try it in LyX.
>
>