[Rd] cleanup temporary directory

2014-09-17 Thread Sandip Nandi
Hi , When a R session runs , it creates a temporary directory . I am using R_CleanTempDir() to clean it up . It looks like its not working properly . So what exactly is going on here is , my example is main() start__R__Interpreter while(1) { execute R scripts using R_parseVector

Re: [Rd] using 2D array of SEXP for creating dataframe

2014-06-27 Thread Sandip Nandi
. Thanks, On Thu, Jun 26, 2014 at 6:35 PM, Hervé Pagès wrote: > On 06/26/2014 05:18 PM, Sandip Nandi wrote: > >> Hi , >> >> I have asked a question , whether the data structure I am using to >> create a dataframe is fine or there is anyother way i can use. My aim

Re: [Rd] using 2D array of SEXP for creating dataframe

2014-06-26 Thread Sandip Nandi
) ; SEXP res = PROTECT(eval(dfm,R_GlobalEnv)); UNPROTECT(7); return res; } On Thu, Jun 26, 2014 at 4:52 PM, Hervé Pagès wrote: > Hi Sandip, > > > On 06/26/2014 04:21 PM, Sandip Nandi wrote: > >> Hi , >> >> I have put incomplete code here . The complet

Re: [Rd] using 2D array of SEXP for creating dataframe

2014-06-26 Thread Sandip Nandi
,valueVector[1]); setAttrib(df,R_RowNamesSymbol,lsnm); PROTECT(dfm=lang3(install("data.frame"),df,ScalarLogical(FALSE))); SET_TAG(CDDR(dfm), install("stringsAsFactors")) ; SEXP res = PROTECT(eval(dfm,R_GlobalEnv)); UNPROTECT(7); return res; } On Thu, Jun 26, 2014 at 3:

[Rd] using 2D array of SEXP for creating dataframe

2014-06-26 Thread Sandip Nandi
Hi , For our production package i need to create a dataframein C . So I wrote the following code SEXP dfm ,head,df , dfint , dfStr,lsnm; *SEXP valueVector[2];* char *ab[3] = {"aa","vv","gy"}; int sn[3] ={99,89,12}; char *listnames[2] = {"int","string"}; int i,j; //

Re: [Rd] Need help on calling Head from C

2014-06-26 Thread Sandip Nandi
Thank you very much . I forgot one thing in my code SET_TAG(CDDR(head), install("n")) ; after that it works Thanks again, Sandip On Thu, Jun 26, 2014 at 2:25 PM, Radford Neal wrote: > > Thank you for the wonderful suggestion . do you suggest to protect > > ScalarInteger(1) > > before calling

Re: [Rd] Need help on calling Head from C

2014-06-26 Thread Sandip Nandi
Thank you for the wonderful suggestion . do you suggest to protect ScalarInteger(1) before calling lang3 ? Thanks On Thu, Jun 26, 2014 at 1:36 PM, Radford Neal wrote: > >> PROTECT(dfm=lang3(install("data.frame"),df,ScalarLogical(FALSE))); > >> SET_TAG(CDDR(dfm), install("stringsAsFactors")) ;

Re: [Rd] Need help on calling Head from C

2014-06-26 Thread Sandip Nandi
Hi , Sorry . I am very sorry . Such a mistake . Sorry for the email . Thanks, Sandip On Thu, Jun 26, 2014 at 9:10 AM, Sandip Nandi wrote: > Hi , > > I am trying to implement the following from C > > > x > a b > 1 1 2 > 2 3 4 > > r<- head(x,n=1) >

Re: [Rd] Need help on calling Head from C

2014-06-26 Thread Sandip Nandi
2014, at 11:31 PM, Sandip Nandi wrote: > > > Hi , > > > > I am trying to call head function from C . My doubt is with the parameter > > n,how to pass it . > > > > PROTECT(dfm=lang3(install("data.frame"),df,ScalarLogical(FALSE))); > > SET_TAG(CD

[Rd] Need help on calling Head from C

2014-06-25 Thread Sandip Nandi
Hi , I am trying to call head function from C . My doubt is with the parameter n,how to pass it . PROTECT(dfm=lang3(install("data.frame"),df,ScalarLogical(FALSE))); SET_TAG(CDDR(dfm), install("stringsAsFactors")) ; SEXP res = PROTECT(eval(dfm,R_GlobalEnv)); PROTECT(head=lang3(install("head"),res,

[Rd] backtrace while trying to clear workspace

2014-05-02 Thread Sandip Nandi
Hi , I tried to do the following . Before I execute the R script , i tried to clear the work space using rm(list = ls(all = TRUE)); . I get the following back trace . Its a huge backtrace , attached a part of it . Can anyone help why I get this ? #13 0x2afd612f in Rf_eval (e=0x1448d68, r

[Rd] question regarding lang2 command in C

2014-04-02 Thread Sandip Nandi
Hi , I am asking too many questions , sorry for that . I am creating a data frame in C itself , reading a table . The data frame calling code looks like this == *PROTECT(dfm=lang2(install("data.frame"),df));* *SEXP res = PROTECT(eval(dfm,R_GlobalEnv));* UNPR

Re: [Rd] Typeof for character vector in dataframe returns integer

2014-04-01 Thread Sandip Nandi
;integer" > > > df[[2]] [1] abc def xyz Levels: abc def xyz Thanks On Tue, Apr 1, 2014 at 6:18 PM, Joshua Ulrich wrote: > > On Apr 1, 2014 8:04 PM, "Sandip Nandi" wrote: > > > > Hi , > > > > I am concerned about the return value of typeof in cha

Re: [Rd] Typeof for character vector in dataframe returns integer

2014-04-01 Thread Sandip Nandi
Hi , I am concerned about the return value of typeof in character column in a dataframe. I expect it to be of character ,it returns integer instead . Thanks On Tue, Apr 1, 2014 at 5:56 PM, Joshua Ulrich wrote: > > On Apr 1, 2014 7:48 PM, "Sandip Nandi" wrote: > > >

Re: [Rd] Typeof for character vector in dataframe returns integer

2014-04-01 Thread Sandip Nandi
ps because indexes start at 0? > > Sent from my iPhone > > > On Apr 1, 2014, at 5:46 PM, Sandip Nandi wrote: > > > > Hi , > > > > I want to know is this behavior expected and why is that ? Need some help > > > > gender <- c("F",

[Rd] Typeof for character vector in dataframe returns integer

2014-04-01 Thread Sandip Nandi
Hi , I want to know is this behavior expected and why is that ? Need some help gender <- c("F", "M", "M", "F", "F", "M", "F", "F") > age<- c(23, 25, 27, 29, 31, 33, 35, 37) > df<- data.frame(gender,age) > typeof(df[[1]]) [1] "integer" > Why is this integer . *Should not it be

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
e would be: >> >>int num_rows = Rf_length(VECTOR_ELT(dataframe, 0)); >>int num_columns = Rf_length(dataframe); >> >> There may be edge cases for which this doesn't work; would need to >> look into how the dim primitive is implemented to be sure. >> &

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
); > > There may be edge cases for which this doesn't work; would need to > look into how the dim primitive is implemented to be sure. > >- Murray > > > On Mon, Mar 31, 2014 at 4:40 PM, Sandip Nandi > wrote: > > Hi , > > > >

[Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
Hi , Is there any C API to the R API nrow of dataframe ? x<- data.frame() n<- nrow(x) print(n) 0 Example : My C function which deals with data frame looks like and I don't to send the number of rows of data frame .I want to detect it from the function itself, my function take data frame as ar

Re: [Rd] How to convert time_t to R date object

2014-03-16 Thread Sandip Nandi
Hi Bill , The following C code may help you , time_t is typedef to long int SEXP getTime() { time_t current_time; char* c_time_string; current_time = time(NULL); c_time_string = ctime(¤t_time); return mkString(c_time_String); // or if you want to return as int vector return s

[Rd] Create dataframe in C from table and return to R

2014-03-06 Thread Sandip Nandi
Hi , I am trying to create a dataframe in C and sebd it back to R. Can anyone point me to the part of the source code where it is doing , let me explain the problem I am having . My simple implementation is like this SEXP for

Re: [Rd] What this error means

2014-02-25 Thread Sandip Nandi
> > > On Tue, Feb 25, 2014 at 12:00 PM, Sandip Nandi wrote: > >> Hi , >> >> I am running R from C using the interpreter . Now i >> execute detach("package:td", unload=TRUE) >> And I get the following error . Any idea what it means ? >

[Rd] What this error means

2014-02-25 Thread Sandip Nandi
Hi , I am running R from C using the interpreter . Now i execute detach("package:td", unload=TRUE) And I get the following error . Any idea what it means ? *** caught segfault *** address 0x102, cause 'memory not mapped' Traceback: 1: sys.parent() 2: sys.function(sys.parent()) 3: formals(s

Re: [Rd] How to set user read request while R install

2014-02-07 Thread Sandip Nandi
e 0022 which is more commonly used (please see unix documentation on the > concepts involved). > > Cheers, > Simon > > > On Feb 7, 2014, at 1:15 PM, Sandip Nandi wrote: > > > Hi , > > > > I have installed R on my system and the user access control looks like &

[Rd] How to set user read request while R install

2014-02-07 Thread Sandip Nandi
Hi , I have installed R on my system and the user access control looks like this -rwxr-x*---* 1 root root 10578117 Feb 3 11:26 libR.so I have installed R as root , but the access control for other is not enabled by default ( at least Read option) . This can be solved using linux ways, but I am

Re: [Rd] Installation of R-3.0.2 failed Fortran error

2014-01-24 Thread Sandip Nandi
Hi , Fortran 4.3 which comes with SDK for suse 11 needs to compiled with a -0 instead of the default -O2 option . Can you try that. Thanks Sandip On Fri, Jan 24, 2014 at 12:24 AM, Prof Brian Ripley wrote: > On 24/01/2014 07:21, claus.neuma...@merckgroup.com wrote: > >> Dear all, >> >> I have

Re: [Rd] Using unicode from C interface of R

2014-01-21 Thread Sandip Nandi
Thank you Prof Brian , Duncan . Let me try that out, Thanks, Sandip On Tue, Jan 21, 2014 at 9:14 PM, Prof Brian Ripley wrote: > On 22/01/2014 00:08, Duncan Murdoch wrote: > >> On 14-01-21 5:41 PM, Sandip Nandi wrote: >> >>> Hi , >>> >>> I am using C

[Rd] Using unicode from C interface of R

2014-01-21 Thread Sandip Nandi
Hi , I am using C interface of R . If a unicode string is read , in what format I could pass it back to R ? I was trying to use the following tpStr = ( char *)val; SET_STRING_ELT(innerList , 0, mkChar(tpStr)); It does not work . If I pass it back from as RAW format to R , what package is the

Re: [Rd] How to debug an R package (with C code)

2014-01-17 Thread Sandip Nandi
Hi , The video may help you http://vimeo.com/11937905 Thanks, Sandip On Thu, Jan 16, 2014 at 4:17 PM, Ma, Saisai - maysy020 < saisai...@mymail.unisa.edu.au> wrote: > Hi all, > > Sorry to bother you. > > I am a beginner in R programming. I have encountered some problems when I > modified a R p

[Rd] Fwd: How to check if R interpreter is initiated

2013-12-20 Thread Sandip Nandi
Hi R-Developers , I am using R-3.1 , moved from R-2.15 . I am facing a problem which I have raised in R bug report with bug 15596 . My problem is how to check if R is initiated before initiating R I am embedding R in parallel environment and reusing process already running to reduce overhead . E