Re: [Rd] Clarifications please.

2009-09-15 Thread Abhijit Bera
Hi I have confusion in evaluating this expression using C. It's similar to my previous expression with the addition of row and column specifiers. I'm confused how to create such objects. Covariance - round(cov(100 * SWX.RET[1:6,c(SBI,SPI,SII)]), I thought of creating vectors for 1:6 and

Re: [Rd] Clarifications please.

2009-09-15 Thread Abhijit Bera
I'm trying to create this object in C SWX.RET[1:6,c(SBI,SPI,SII)] While i am able to access and use a simple SWX.RET object, I'm getting confused on how to create an object with the array subscripts like above. Here is what I tried to do. It doesn't work becase [ is obviously not an operation

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
Hi Martin Here's the code. I'm stuck at one point. I cannot figure out how to print the dimnames. I've commented it in my code: int main (int argc, char** argv) { SEXP e,t1,t2,val; int errorOccurred,nx,ny,i,j; double *v; char x[1024],y[1024]; Rf_initEmbeddedR(argc, argv);

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
Hi Simon Thanks. All the confusion between CHAR and STRING. First I read this : http://www1.cuni.cz/~obo/r_surprises.html In the meantime I got your reply. Then I read the documentation and it made sense! Regards Abhijit Bera On Fri, Aug 28, 2009 at 6:49 PM, Simon Urbanek

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
Hi Simon/Martin I have updated the code. I think I may be doing mistakes with PROTECT and UNPROTECT but the code works fine, no errors or warnings so far. Please suggest any improvements/changes. #include R.h #include Rinternals.h #include Rdefines.h #include Rembedded.h int main (int argc,

Re: [Rd] Clarifications please.

2009-08-28 Thread Simon Urbanek
On Aug 28, 2009, at 9:42 AM, Abhijit Bera wrote: Hi Simon Thanks. All the confusion between CHAR and STRING. First I read this : http://www1.cuni.cz/~obo/r_surprises.html Uh, oh, that doc confuses things even more and is not really correct (well, the author admits that he has no idea,

Re: [Rd] Clarifications please.

2009-08-27 Thread Abhijit Bera
Hi Martin Sorry, I made a mistake, I wasn't looking at the syntactic correctness of your code, I just followed what you suggested. Your method is valid when I want to extract data from a class. I was trying to get data from a covariance matrix. I'll put up code in my next mail showing how to

Re: [Rd] Clarifications please.

2009-08-27 Thread Dirk Eddelbuettel
Abhijit, On 27 August 2009 at 19:29, Abhijit Bera wrote: | Hi Martin | | Sorry, I made a mistake, I wasn't looking at the syntactic correctness of | your code, I just followed what you suggested. | | Your method is valid when I want to extract data from a class. I was trying | to get data from

Re: [Rd] Clarifications please.

2009-08-26 Thread Abhijit Bera
Hi Martin Thanks. I think I got it! Read the R extensions documentation again. I don't even need to convert to a list. This is what I did (just a demo): #include R.h #include Rinternals.h #include Rdefines.h #include Rembedded.h int main (int argc, char** argv) { SEXP e,t1,t2,val; int

Re: [Rd] Clarifications please.

2009-08-26 Thread Martin Morgan
Hi Abhijit -- Abhijit Bera wrote: Hi Martin Thanks. I think I got it! Read the R extensions documentation again. I don't even need to convert to a list. This is what I did (just a demo): #include R.h #include Rinternals.h #include Rdefines.h #include Rembedded.h int main (int argc,

Re: [Rd] Clarifications please.

2009-08-26 Thread Simon Urbanek
On Aug 26, 2009, at 12:55 , Martin Morgan wrote: Hi Abhijit -- Abhijit Bera wrote: Hi Martin Thanks. I think I got it! Read the R extensions documentation again. I don't even need to convert to a list. This is what I did (just a demo): #include R.h #include Rinternals.h #include

[Rd] Clarifications please.

2009-08-25 Thread Abhijit Bera
Hi I think I have asked these questions earlier, but I been able to find answers from the documentation (which I found poorly written in several places). Will someone be kind enough to give me answers and enlighten me? (as in explain with CODE?) I want to embed R in my application and use the