Re: including a Sweave/R code chunk in a LyX table cell

2010-05-14 Thread [Ricardo Rodriguez] eBioTIC.

Hi!

Rob Oakes wrote:

This is clearly either a problem in the way that R installs itself, or
the way that LaTeX installs itself.  I'm not actually sure which though
and I don't know where to file the bug report.
  


It Sweave.sty is required by LaTeX only when used with R, who must we 
take care of the correct installation of the style file? Sorry, I don't 
know LaTeX as for being able to answer this question!

When I just checked, I was not able to find a "sweave" package for R,
nor was I able to find one for TeXLive 2009 (don't know about MikTeX).
But I've experienced a similar problem on Mac OS X and on Linux, which
provides some evidence that it's not getting packaged.
  


As far as I can find, Sweave is included with R at least as of R 2.4.1 
In R, ...


help("Sweave", package="utils")

Read this from http://tinyurl.com/346jrnu ...

"Unfortunately, Sweave hard-codes the absolute path to its style files 
in its LaTeX output. The path to the style files depends on where R was 
installed on the local system. This means that while an Sweave document 
may be portable, the LaTeX file it produces is not. If you receive a 
LaTeX document produced by Sweave on someone else's computer, you will 
need to edit the path inside the \usepackage statement so that it points 
to the Sweave style file location on your computer. If you want to give 
your LaTeX file to someone who does not have R, you can delete the 
reference to Sweave and paste in the contents of the Sweave.sty file. "

Because out of the box support for Sweave is one of LyX 2's newest (and
IMHO, killer) features, it might make sense to include a copy of
Sweave.sty with the installation script and have it installed at the
time of LyX configuration.  LyX already does this with a few specialty
document classes anyway (broadway, hollywood).

  
As Sweave.sty file will be only required by people not running R, I 
think it must be "maintained" by LyX and/or LaTeX bundles.


But I'm just a newbie here! Please, any insight will be extremely 
welcome! Thanks!


Greetings,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-13 Thread [Ricardo Rodriguez] eBioTIC.

Hi!

I've been trying to learn a bit more about LyX, LaTeX, R and Sweave to 
better understand this issue :-)


Jean-Marc LASGOUTTES wrote:


It is expected (by me at least) that either:

1/ the installation of R installs Sweave.sty at the right place (was
MaxTeX already installed when you installed R?)
  


Yes, MacTex was installed when I installed R. Please, what does it mean? 
Must I get a different result if MacTex was not installed before R 
installation?

or

2/ Sweave is set up in such a way that it puts the full path to the
Sweave.sty file in the \usepackage command.
  
The point is that there is no Sweave.sty in the system. Neither before R 
installation, nor before after it.


As far as I understand, and read, it is expected that R copy Sweave.sty 
on my system although I don't know yet if I must also expect that the 
texmf tree is modified with the same installation or the user must 
customize the installation on his/her own.


Actually, with the new LyX 2.0 releases, I don't know if Sweave.sty is 
required by LyX at all!


Sorry, I am still a bit puzzle with this issue!

Thanks!

Ricardo



--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread Rob Oakes
This is clearly either a problem in the way that R installs itself, or
the way that LaTeX installs itself.  I'm not actually sure which though
and I don't know where to file the bug report.

When I just checked, I was not able to find a "sweave" package for R,
nor was I able to find one for TeXLive 2009 (don't know about MikTeX).
But I've experienced a similar problem on Mac OS X and on Linux, which
provides some evidence that it's not getting packaged.

Because out of the box support for Sweave is one of LyX 2's newest (and
IMHO, killer) features, it might make sense to include a copy of
Sweave.sty with the installation script and have it installed at the
time of LyX configuration.  LyX already does this with a few specialty
document classes anyway (broadway, hollywood).

Cheers,

Rob



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread Jean-Marc LASGOUTTES
"[Ricardo Rodriguez] eBioTIC."  writes:
> *3.* If I try to compile a new document including S/R expressions,
> compilation fails throwing the following error:
>
> ! LaTeX Error: File `Sweave.sty' not found.
>
> Here the full stack to further reference:
>
> http://xen.net/onLyX/lyxSweaveStyNotFound.html
> Please, provided its module is loaded, must Sweave work out of the box
> in LyX 2.0? Is it expected that Sweave.sty is included with LaTeX? I
> guess a warning will be required some where to avoid the problem we
> are facing here! Thanks!

It is expected (by me at least) that either:

1/ the installation of R installs Sweave.sty at the right place (was
MaxTeX already installed when you installed R?)

or

2/ Sweave is set up in such a way that it puts the full path to the
Sweave.sty file in the \usepackage command.

If neither of those two conditions are fulfilled, I think this is a bug
in the way R installs itself...

JMarc


Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread [Ricardo Rodriguez] eBioTIC.

Hi!

lyx-de...@oak-tree.us wrote:

Hi JMarc,

Reasonably sure.  I was having the problems back in November.  And there
were two separate issues.  The first was getting LyX 2 to work, the second
was related to getting R + Sweave to work.

The problems that eventually required Sweave.sty were related to getting
documents to compile correctly.  Without it, the compilation would simply
terminate with "There was an R error" or some such.  After placing
Sweave.sty in the tex path, this resolved itself.
  


Being truth what I've said before and what JMarc said about LyX checking 
R availability to load Sweave module, I'm facing the same problem Rob 
describes when trying to compile a new document including S/R 
expressions. I will try to describe the situation:



*1.* A LyX 2.0.0 alpha2 installation crashes when trying to load Sweave 
module if R is not installed in the same box. In this case, I guess it 
will be advisable to trigger a warning saying that R is required instead 
of causing an exception that crashes LyX. I'm sure developers are 
consciences of this and the only problem here is time to make the 
required changes! :-)


*2. *Once R is installed, Sweave module loads without a glitch.

*3.* If I try to compile a new document including S/R expressions, 
compilation fails throwing the following error:


! LaTeX Error: File `Sweave.sty' not found.

Here the full stack to further reference:

http://xen.net/onLyX/lyxSweaveStyNotFound.html

As stated in a previous message, the LaTeX environment here was created 
as per...


http://www.tug.org/mactex/2009/
[ approximately 1.3G - 12 March 2010 ]
MacTeX-2009.mpkg
MacTeX.mpkg.zip

*4. *Until I copy Sweave.sty to the TeX path and reconfigure LyX, 
compilation fails.


I copied Sweave.sty from a older box with a running LyX 1.6.5/Sweave/R 
installation.


GMXUX-Ricardo-Rodriguez:~ rrodriguez$ kpsewhich Sweave.sty
/Users/rrodriguez/Library/texmf/tex/latex/R/Sweave.sty



Please, provided its module is loaded, must Sweave work out of the box 
in LyX 2.0? Is it expected that Sweave.sty is included with LaTeX? I 
guess a warning will be required some where to avoid the problem we are 
facing here! Thanks!


Let me know if I can be of any further help!

Greetings,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread Jean-Marc LASGOUTTES
"[Ricardo Rodriguez] eBioTIC."  writes:
> Sorry, I replied to Rob's message before reading this one! That's what
> I've found here: Sweave.sty as is is not longer in the path and LyX
> looks for R libraries instead. Is it ok this interpretation? Thanks!

Yes. But still it should not crash...

JMarc


Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread lyx-devel
Hi JMarc,

Reasonably sure.  I was having the problems back in November.  And there
were two separate issues.  The first was getting LyX 2 to work, the second
was related to getting R + Sweave to work.

The problems that eventually required Sweave.sty were related to getting
documents to compile correctly.  Without it, the compilation would simply
terminate with "There was an R error" or some such.  After placing
Sweave.sty in the tex path, this resolved itself.

But then, I haven't really spent much time working on the Mac since then. 
Problems with PyQt (related to work stuff) have forced me over to my Linux
laptop, and that's what I've mostly been working with for the last seven
months.

It wasn't till this morning that sat down again to take a look at the
problem.  About the same time that it was reported solved ;)

If I have any problems, I'll be sure to file a bug report/send an email to
the developer list.

Cheers,

Rob

> Rob Oakes  writes:
>> Just one thought, make sure that there is a copy of Sweave.sty installed
>> in your LaTeX path (and make sure that LyX can find it).  I was having
>> some troubles with Sweave and LyX 2.0 on Mac a while ago, and this is
>> what ultimately fixed it.
>
> Are you sure? It should not be necessary on 2.0. What is needed though
> is to have R installed and available in the path. The module tests the
> availability of a Rnw>tex converter (aka R CMD Sweave).
>
> JMarc
>




Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread [Ricardo Rodriguez] eBioTIC.

Oops!

Jean-Marc LASGOUTTES wrote:

Rob Oakes  writes:
  

Just one thought, make sure that there is a copy of Sweave.sty installed
in your LaTeX path (and make sure that LyX can find it).  I was having
some troubles with Sweave and LyX 2.0 on Mac a while ago, and this is
what ultimately fixed it.



Are you sure? It should not be necessary on 2.0. What is needed though
is to have R installed and available in the path. The module tests the
availability of a Rnw>tex converter (aka R CMD Sweave).
  


Sorry, I replied to Rob's message before reading this one! That's what 
I've found here: Sweave.sty as is is not longer in the path and LyX 
looks for R libraries instead. Is it ok this interpretation? Thanks!


Greetings,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread [Ricardo Rodriguez] eBioTIC.

Hi Rob!

Rob Oakes wrote:

Hi Ricardo,

Just one thought, make sure that there is a copy of Sweave.sty installed
in your LaTeX path (and make sure that LyX can find it).  I was having
some troubles with Sweave and LyX 2.0 on Mac a while ago, and this is
what ultimately fixed it.

  


Nope, it is not! In fact Sweave.sty is no where in the path. It seems it 
looks for R! R was not installed in this box! Shame on me! Once 
installed, LyX 2.0 no longer crashes while loading Sweave module.


Thanks for your help!



But, to be honest, I haven't really played with LyX 2.0 on my Mac
recently.  I've been on a book deadline and it just felt to unstable to
any real work.  On Linux, though, it's been very reliable.

  
I will keep an eye on new releases and maintain this experimental 
installation on the MacPro running Mac OS X 10.6.3 and at the same time 
keep running a stable a 1.6.5 release in a 10.5.8 MacBook Pro. I have 
not two available boxes with the same SO. Please, let me know if I can 
be of any further help to debug this or any other issue. Thanks!


Greetings,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-11 Thread Jean-Marc LASGOUTTES
Rob Oakes  writes:
> Just one thought, make sure that there is a copy of Sweave.sty installed
> in your LaTeX path (and make sure that LyX can find it).  I was having
> some troubles with Sweave and LyX 2.0 on Mac a while ago, and this is
> what ultimately fixed it.

Are you sure? It should not be necessary on 2.0. What is needed though
is to have R installed and available in the path. The module tests the
availability of a Rnw>tex converter (aka R CMD Sweave).

JMarc


Re: including a Sweave/R code chunk in a LyX table cell

2010-05-10 Thread Rob Oakes
Hi Ricardo,

Just one thought, make sure that there is a copy of Sweave.sty installed
in your LaTeX path (and make sure that LyX can find it).  I was having
some troubles with Sweave and LyX 2.0 on Mac a while ago, and this is
what ultimately fixed it.

But, to be honest, I haven't really played with LyX 2.0 on my Mac
recently.  I've been on a book deadline and it just felt to unstable to
any real work.  On Linux, though, it's been very reliable.

Cheers,

Rob

On Tue, 2010-05-11 at 00:13 +0200, [Ricardo Rodriguez] eBioTIC. wrote:
> Hi!
> 
> Jean-Marc LASGOUTTES wrote: 
> > > Without doing any other step, if I create a new document and go to
> > > Document>Settings>Modules and try to add Sweave module, LyX crashes. I
> > > am nevertheless able to add other modules like Braille or EndNote.
> > > 
> > 
> > This is bad. However, I do not see where it comes from. Do you have
> > messages in the console (launch Console.app and look for messages that
> > may come from LyX).
> > 
> >   
> 
> Sorry, I've not been able to regain access to the concerned box until
> late in the afternoon. Here what I've found:
> 
> These are the lines recorded in the console log each time LyX crashes
> after trying to load Sweave module:
> 
> *
> 5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] terminate called
> after throwing an instance of 'lyx::support::ExceptionMessage'
> 5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685]   what():  Package
> not available
> 5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] The module sweave
> requires a package that is
> 5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] not available in
> your LaTeX installation. LaTeX output
> 5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] may not be possible.
> 5/10/10 7:06:09 PM com.apple.launchd.peruser.501[121]
> ([0x0-0x57057].org.lyx.lyx[685]) Job appears to have crashed: Abort
> trap
> 5/10/10 7:06:09 PM ReportCrash[907] Saved crash report for lyx[685]
> version 2.0.0alpha2 (???)
> to 
> /Users/rrodriguez/Library/Logs/DiagnosticReports/lyx_2010-05-10-190609_Ricardo-Rodriguezs-Mac-Pro.crash
> *
> 
> For easier reference...
> 
> http://xen.net/onLyX/lyxCrashConsoleMessages.html
> 
> The full report generated by Mac OS X is available here...
> 
> http://xen.net/onLyX/lyxCrashProbReport.html
> 
> The box has a fresh and fully updated Mac OS X 10.6.3 (10D573)
> 
> I've installed MacTeX (as per section 2.2 at
> http://www.lyx.org/Download) prior to install LyX 1.6.5, then to
> install LyX 2.0.0 alpha2
> 
> The link at the LyX download page drove me to...
> http://www.tug.org/mactex/2009/
> [ approximately 1.3G - 12 March 2010 ] 
> MacTeX-2009.mpkg
> MacTeX.mpkg.zip
> 
> Please, does this make any sense for you? Let me know how I can be of
> any further help. Thanks!
> 
> Cheers,
> 
> Ricardo 
> -- 
> Ricardo Rodríguez
> CTO
> eBiotic.
> Life Sciences, Data Modeling and Information Management Systems




Re: including a Sweave/R code chunk in a LyX table cell

2010-05-10 Thread [Ricardo Rodriguez] eBioTIC.

Hi!

Jean-Marc LASGOUTTES wrote:

Without doing any other step, if I create a new document and go to
Document>Settings>Modules and try to add Sweave module, LyX crashes. I
am nevertheless able to add other modules like Braille or EndNote.



This is bad. However, I do not see where it comes from. Do you have
messages in the console (launch Console.app and look for messages that
may come from LyX).

  


Sorry, I've not been able to regain access to the concerned box until 
late in the afternoon. Here what I've found:


These are the lines recorded in the console log each time LyX crashes 
after trying to load Sweave module:


*
5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] terminate called after 
throwing an instance of 'lyx::support::ExceptionMessage'
5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685]   what():  Package not 
available
5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] The module sweave 
requires a package that is
5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] not available in your 
LaTeX installation. LaTeX output

5/10/10 7:06:09 PM [0x0-0x57057].org.lyx.lyx[685] may not be possible.
5/10/10 7:06:09 PM com.apple.launchd.peruser.501[121] 
([0x0-0x57057].org.lyx.lyx[685]) Job appears to have crashed: Abort trap
5/10/10 7:06:09 PM ReportCrash[907] Saved crash report for lyx[685] 
version 2.0.0alpha2 (???) to 
/Users/rrodriguez/Library/Logs/DiagnosticReports/lyx_2010-05-10-190609_Ricardo-Rodriguezs-Mac-Pro.crash

*

For easier reference...

http://xen.net/onLyX/lyxCrashConsoleMessages.html

The full report generated by Mac OS X is available here...

http://xen.net/onLyX/lyxCrashProbReport.html

The box has a fresh and fully updated Mac OS X 10.6.3 (10D573)

I've installed MacTeX (as per section 2.2 at 
http://www.lyx.org/Download) prior to install LyX 1.6.5, then to install 
LyX 2.0.0 alpha2


The link at the LyX download page drove me to...
http://www.tug.org/mactex/2009/
[ approximately 1.3G - 12 March 2010 ]
MacTeX-2009.mpkg
MacTeX.mpkg.zip

Please, does this make any sense for you? Let me know how I can be of 
any further help. Thanks!


Cheers,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-10 Thread Jean-Marc LASGOUTTES
"[Ricardo Rodriguez] eBioTIC."  writes:
> I'm afraid I am facing some kind of problem here. I've downloaded the
> 2.0 alfa release and installed in on an MacPro running Mac OS X 10.6.3
> and on top of a LyX 1.6.5 installation running fine.
>
> First of all, please, after copying the new LyX to Applications, must
> I perform some new action before using the new release? I am afraid I
> am missing some basic step due to my lack of understanding of the
> whole system. The new *.dmg doesn't content any install file to
> configure LyX on a per user basis.

The maintainer of the mac version has changed, so I cannot say for sure
what changes he did the the packaging. In any case, you could try to run
LyX>Reconfigure, which should not hurt...

> Without doing any other step, if I create a new document and go to
> Document>Settings>Modules and try to add Sweave module, LyX crashes. I
> am nevertheless able to add other modules like Braille or EndNote.

This is bad. However, I do not see where it comes from. Do you have
messages in the console (launch Console.app and look for messages that
may come from LyX).

JMarc


Re: including a Sweave/R code chunk in a LyX table cell

2010-05-10 Thread [Ricardo Rodriguez] eBioTIC.

Thanks Julien and Rob,

Rob Oakes wrote:

Hi Ricardo,

Sweave in LyX 2.0 works a little different.  Instead of being relegated
to a single document class, it has instead been implemented as a module.
The upside is that you can now use Sweave with any document class and
with any LaTeX variant (my personal favorite class is the Tufte
Handout).  This wasn't possible in LyX 1.6 (or, I should say, it was
possible but much more difficult).

But before you can use the module, you need to add it to your document.
This is done from the Document->Settings->Modules pane.  Once the pane
is loaded, simply scroll down to Sweave and add it to your dodcument.
Then click on "Ok" or "Apply".

Once you have done this, a couple of new inset options should appear in
the Inset->Custom menu.  If you have any problems, go ahead and shoot me
an email.
  


I'm afraid I am facing some kind of problem here. I've downloaded the 
2.0 alfa release and installed in on an MacPro running Mac OS X 10.6.3 
and on top of a LyX 1.6.5 installation running fine.


First of all, please, after copying the new LyX to Applications, must I 
perform some new action before using the new release? I am afraid I  am 
missing some basic step due to my lack of understanding of the whole 
system. The new *.dmg doesn't content any install file to configure LyX 
on a per user basis.


Without doing any other step, if I create a new document and go to 
Document>Settings>Modules and try to add Sweave module, LyX crashes. I 
am nevertheless able to add other modules like Braille or EndNote.


Please, does this make any sense for you? Thanks!

All the best,

Ricardo


--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread Rob Oakes
Hi Ricardo,

Sweave in LyX 2.0 works a little different.  Instead of being relegated
to a single document class, it has instead been implemented as a module.
The upside is that you can now use Sweave with any document class and
with any LaTeX variant (my personal favorite class is the Tufte
Handout).  This wasn't possible in LyX 1.6 (or, I should say, it was
possible but much more difficult).

But before you can use the module, you need to add it to your document.
This is done from the Document->Settings->Modules pane.  Once the pane
is loaded, simply scroll down to Sweave and add it to your dodcument.
Then click on "Ok" or "Apply".

Once you have done this, a couple of new inset options should appear in
the Inset->Custom menu.  If you have any problems, go ahead and shoot me
an email.

Cheers,

Rob

On Sun, 2010-05-09 at 23:15 +0200, [Ricardo Rodriguez] eBioTIC. wrote: 
> Rob,
> 
> >
> > Rob Oakes wrote:
> >
> >> If the code chunk is short, you can also use S/R expression insets.
> >> (Not sure if this is available in LyX 1.6.5.  From LyX 2.0, go to
> >> Insert->Custom Inserts->S/R expression). 
> 
> I've just installed LyX-2.0.0alpha2.dmg and I don't find the S/R 
> expression option in Insert>Custom Insets.
> 
> Must it be available out of the box?
> 
> Thanks!
> 
> Ricardo
> 




Re: including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread Julien Rioux

On 09/05/2010 5:15 PM, [Ricardo Rodriguez] eBioTIC. wrote:

I've just installed LyX-2.0.0alpha2.dmg and I don't find the S/R
expression option in Insert>Custom Insets.

Must it be available out of the box?

Thanks!

Ricardo



The sweave module should be there out of the box. Once you add it to 
your document (Under Document > Settings > Modules), the custom inset 
should become available from the menu.


Cheers,
Julien


Re: including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread [Ricardo Rodriguez] eBioTIC.

Rob,



Rob Oakes wrote:


If the code chunk is short, you can also use S/R expression insets.
(Not sure if this is available in LyX 1.6.5.  From LyX 2.0, go to
Insert->Custom Inserts->S/R expression). 


I've just installed LyX-2.0.0alpha2.dmg and I don't find the S/R 
expression option in Insert>Custom Insets.


Must it be available out of the box?

Thanks!

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread [Ricardo Rodriguez] eBioTIC.

Thanks, Rob!

Rob Oakes wrote:

Hi Ricardo,

<>

For reasons I do not really understand, R code within tables (or figure
floats) can be very fragile.  LyX 2.0 makes this better through the
Sweave module, but it is still not perfect.

The best way I have found for overcoming the fragility is to place it
within a minipage.  You can do this by clicking on Insert->Box, and then
placing the code within there.
  


This works fine! By putting an ERT within the minipage problems are solved!

If the code chunk is short, you can also use S/R expression insets.
(Not sure if this is available in LyX 1.6.5.  From LyX 2.0, go to
Insert->Custom Inserts->S/R expression).
  


No Custom Insert is available out of the box with LyX 1.6.5. I guess LyX 
2.0 is in beta stage (I found some spare references to it in 
latex-community.org). I don't know why but I've not access to LyX 
website right now, I'll check it asap and move ahead to this release. 
I'm currently in an entry stage of my work with LyX, thus it is a 
perfect time for experimentation!


BTW, I see that your message has been sent to lyx-de...@oak-tree.us as 
well as to lyx-us...@lists.lux.org. Just to be polite and to respect the 
rules, is is expected that I reply to the list? Just to the sender?


Thanks for your help and advice!

Greetings,

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems



Re: including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread Rob Oakes
Hi Ricardo,

<>

For reasons I do not really understand, R code within tables (or figure
floats) can be very fragile.  LyX 2.0 makes this better through the
Sweave module, but it is still not perfect.

The best way I have found for overcoming the fragility is to place it
within a minipage.  You can do this by clicking on Insert->Box, and then
placing the code within there.

If the code chunk is short, you can also use S/R expression insets.
(Not sure if this is available in LyX 1.6.5.  From LyX 2.0, go to
Insert->Custom Inserts->S/R expression).

Cheers,

Rob Oakes



including a Sweave/R code chunk in a LyX table cell

2010-05-09 Thread [Ricardo Rodriguez] eBioTIC.

Hi all,

I've posted this same message yesterday evening at 
http://www.latex-community.org LyX forum. Please, accept my apologies 
for cross-posting! I'm new to this LyX world and trying to identify the 
best way of getting/providing help! Here the issue:


I've successfully installed R 2.11.0 and LyX 1.6.5 in a MacBook Pro 
running Mac OS X 10.5.8. Some examples including more or less complex R 
code chunks run without a glitch.


But I am not able to include a R code chuck within a table.

This works fine:


% Preview source code for paragraph 10

<>=
qs=1
@


But this doesn't work:


% Preview source code for paragraph 11

\begin{tabular}{|c|}
\hline
<>=
pot=2
@
\tabularnewline
\hline
\end{tabular}


The LyX literate errors window gives this information:

*
Errors:

LaTeX Error: Something's wrong--perhaps a missing \item.
LaTeX Error: Something's wrong--perhaps a missing \item.
LaTeX Error: Something's wrong--perhaps a missing \item.
LaTeX Error: Something's wrong--perhaps a missing \item.

Description:

\begin{Sinput}

Try typing  to proceed.
If that doesn't work, type X  to quit.
*

This proposal by gmedina at http://www.latex-community.org LyX forum, 
avoids the error, but the result is a table with those lines in the 
table, not with the R results.




Please, where am I wrong? Is it not possible to include R code chunks in 
LyX tables?


Thanks for your help!

Ricardo

--
Ricardo Rodríguez
CTO
eBiotic.
Life Sciences, Data Modeling and Information Management Systems