Naw, the issue is just that R is messy. Actually, for this particular case, I was chuckling a bit since it isn't wrong how R did it, it is just the way R does it. C++ is exactly the same. Unfortunately, the answer that I will give for this thread is that the OP should really just learn R or figure out a workaround. I have done a huge amount of work in many languages and basically I would not wish to merge them. Loosely coupled code is much better than tightly coupled. Reading in a CSV or a PDF is much better style than generating it and working with it inside of a document. Eventually you start asking yourself questions like, if I gave this Lyx document to a friend, would they have any idea what I did and could they figure it out in under 2 minutes? If the answer is no, I might suggest finding a different way to attack the problem.
I was thinking about this though. For plots, R is one of the best tools you can use. Believe you me, illustrator is probably the best but R does a really good job and is not 800$. What I really recommend for plots is that you save the plot and load it into the document. I have done this many times. That way, you are regenerating the same plot every time you compile your document. Also, as long as you can generate a PDF image, you can include it. Now I bet there is a case where the plot should be dynamic with every compile and if that is the case, I don't really know where to go apart from learning R... if only for the plotting which is some of the best you will find anywhere. I actually find the whole idea of integrating R into Lyx to be interesting but misses the point a bit. For tables I could see it being very useful but within the boundaries of whatever automatically sets up the table formatting. For images, I would save it and import it as a pdf. BTW, I have had no end of problems working with sweave and the stata latex output. It essentially requires me to rewrite the tables anyway. Problems range anywhere from writing off the end of the page to generating tables which are unreadable. BTW, totally off topic but Python is very versatile. It actually makes much more sense with the power behind dictionaries, document parsing, document merging, string manipulations, data management, etc. for it to be included in Lyx. That I am sure was a feat of engineering. I honestly don't know what to tell the OP anymore as latex includes many many ways to integrate PDF images within a document. Generating the PDF outside of the document and importing it seems like far less work than trying to get it all working in Lyx. ~Ben On Wed, Jan 28, 2015 at 10:56 PM, Jerry <lancebo...@qwest.net> wrote: > > On Jan 25, 2015, at 2:56 PM, Benedict Holland < > benedict.m.holl...@gmail.com> wrote: > > > On Sun, Jan 25, 2015 at 4:38 PM, Francesco Menoncin < > francesco.menon...@unibs.it> wrote: > > Hello Benedict, > > thank you for your answer. > > I give you an example about how R is difficult for dealing with > matrices: if in Matlab (or Scilab or Octave or simila) I write: > > > > x(2,2)=10 > > > > the following matrix is automatically created: > > > > [0 0 > > 0 2] > > > > while in R > > > > x[2,2]=10 > > > > gives an error because I first have to declare to R that x is a matrix > and, furthermore, give it the right dimension. > > If, afterward, I want to add an element to the matrix x, in Matlab I > simply write: > > > > x(3,1)=5 > > > > and I obtain the matrix: > > > > [0 0 > > 0 10 > > 5 0] > > > > while in R I cannot do that, because x has already been defined as a 2 > by 2 matrix. > > I find all this very inefficient for dealig with matrices. > > This is my point :-) > > > > Francesco > > > I'm not familiar with R but what you are saying about R in comparison with > Matlab or Octave is that Matlab/Octave do not check array bounds. Thus, you > might erroneously write into a matrix element that doesn't exist and > Matlab/Octave does not report an error. Array bounds checking is the price > to pay for having safer code. FWIW, Python and Mathematica are examples of > languages that are only "half-safe" with respect to array indexing, meaning > if you write past the beginning of an array (usually negative indexes) it > assumes you want to index the array backwards, from the end. These are all > conveniences but of course can also cause erroneous results or increased > time spent debugging. I personally am happy to write in a safe language > (Ada) and spend a little bit more time writing code (it's easy to declare a > new array and copy the old one into it; you can write a subroutine if you > want) and virtually zero time chasing bugs, but others prefer otherwise and > that's fine. > > Jerry