search for: lang3

Displaying 18 results from an estimated 18 matches for "lang3".

Did you mean: lang
2009 Sep 29
3
How do I access class slots from C?
...kString("SBI"),mkString("SPI"),mkString("SII"))); PROTECT(tsAssets=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang4(install("["),install("SWX.RET"),R_MissingArg,tsAssets)); PROTECT(tsReturns=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang3(install("*"),ScalarInteger(100),tsReturns)); PROTECT(tsReturns=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang3(install("portfolioData"),tsReturns,portSpec)); PROTECT(portData=R_tryEval(e,R_GlobalEnv,NULL)); // Creating a portfolio constraints string PROTECT(por...
2023 Mar 23
1
`dendrapply` Enhancements
Hello Aidan, Sorry for dropping this for a while. ? Thu, 2 Mar 2023 21:03:59 +0000 "Lakshman, Aidan H" <AHL27 at pitt.edu> ?????: > //after > curnode = eval(lang3(R_Bracket2Symbol, parent->node, DEND_IND), env); lang3() always constructs a new language object. If you do end up using eval(), it may make sense to move lang3() out of the loop and reuse the existing object by referring to the DEND_IND variable using its symbol, like it's done in the lapp...
2014 Jun 25
1
Need help on calling Head from C
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,ScalarInteger(1))); head = PROTECT(eval(head,R_GlobalEnv)); I tried the above followi...
2009 Oct 29
2
Help with lang4
Hi I seem to have run into a situation where I have more than 3 arguments to pass to a function from C. the following functions help me build an expression for evaluation: lang lang2 lang3 lang4 What should one do if there are more arguments than lang4 can handle? Regards Abhijit Bera [[alternative HTML version deleted]]
2019 Nov 01
3
R C api for 'inherits' S3 and S4 objects
...if (isString(klass = getAttrib(x, R_ClassSymbol))) { for (int i=0; i<LENGTH(klass); i++) { if (STRING_ELT(klass, i) == char_) return true; } } return false; } // S4 inheritance bool Rinherits(SEXP x, SEXP char_) { SEXP vec = PROTECT(ScalarString(char_)); SEXP call = PROTECT(lang3(sym_inherits, x, vec)); bool ans = LOGICAL(eval(call, R_GlobalEnv))[0]==1; UNPROTECT(2); return ans; }
2012 May 23
2
Expected behaviour of is.unsorted?
...ass (where the >= or > method is used)" which I don't understand. Where >= or > is used by what, and where? I understand why the first two are FALSE (1 item of anything must be sorted). I don't understand the 3rd and 4th cases where length is 2: do_isunsorted seems to call lang3(install(".gtn"), x, CADR(args))). Does that fall back to TRUE for some reason? Matthew > sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=Engl...
2019 Nov 01
4
[External] R C api for 'inherits' S3 and S4 objects
...lass); i++) { > > if (STRING_ELT(klass, i) == char_) return true; > > } > > } > > return false; > > } > > // S4 inheritance > > bool Rinherits(SEXP x, SEXP char_) { > > SEXP vec = PROTECT(ScalarString(char_)); > > SEXP call = PROTECT(lang3(sym_inherits, x, vec)); > > bool ans = LOGICAL(eval(call, R_GlobalEnv))[0]==1; > > UNPROTECT(2); > > return ans; > > } > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman...
2009 Sep 16
2
I want to get a reference to this time series object
...ortfolioSpec"))); PROTECT(portSpec=R_tryEval(e,R_GlobalEnv, NULL)); // creating a portfolioData object PROTECT(e=lang4(install("c"),mkString("SBI"),mkString("SPI"),mkString("SII"))); PROTECT(c=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang3(install("["),install("SWX.RET"),c)); PROTECT(portData=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang2(install("print"),portData)); R_tryEval(e,R_GlobalEnv,NULL); UNPROTECT(3); Rf_endEmbeddedR(0); return 0; } [[alternative HTML version del...
2009 Sep 15
1
How can I use R:sort function in C code?
Hi, I wrote a C extension for R. Within the C code I wanted to invoke the R's sort function, with the argument "index.return = TRUE". I found it is a difficult problem, how can I do that? I have implemented the decreasing sorting by the code "PROTECT(R_fcall = lang3(install("sort"), x, desc));", but how to define the "index.return" argument? Thanks in advanced! -- Guozhu. Wen mail: guozhuwen@gmail.com douban: http://www.douban.com/people/wentrue/ blog: http://www.wentrue.net/blog/ twitter: https://twitter.com/wentrue [[alternative...
2007 Aug 16
0
call R function in c++ program
...OTECT( e1 = mkString("plot(variable_name, type=\"l\")") ); PROTECT( e2 = R_ParseVector(e1, 1, &status, R_NilValue) ); R_tryEval(VECTOR_ELT(e2,0), rho, &hadError); UNPROTECT(2); // for execute "simple" function (without parser) PROTECT( e1 = lang3(install(":"), ScalarInteger(1), ScalarInteger(4)) ); PROTECT( e2 = lang4(install("matrix"), e1, ScalarInteger(4), ScalarInteger(1)) ); PROTECT( e3 = lang2(install("layout"), e2) ); eval(e3,R_GlobalEnv); UNPROTECT(3); // for call library (using pars...
2013 May 08
2
call R function from C code
Hi, I am writing C code for R, but in middle of the routine I want to call solve(A,b) function. What is the right way to solve linear set inside C code? Is it ok to just invoke La_solve()?
2008 Feb 27
1
Warnings generated by log2()/log10() are really large/takes a long time to display
x <- rnorm(1e6); y <- log(x); # or logb(x) or log1p(x) w <- warnings(); print(object.size(w)); ## [1] 480 str(w); $ NaNs produced: language log(x) - attr(*, "dots")= list() - attr(*, "class")= chr "warnings" y <- log2(x); # or log10(x) w <- warnings(); print(object.size(w)); ## [1] 8000536 str(w); ## List of 1 ## $ NaNs produced: language
2009 Aug 25
2
Clarifications please.
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 fPortfolio package for carrying out risk management computations. Right now I'm reading the Rmetrics
2009 May 26
1
passing "..." arguments to a function called by eval()
...return(retVal) } ########## C code, in pkg/src directory SEXP dTestC(SEXP dblX, SEXP funFn, SEXP dots, SEXP rho); /*--------------------------*/ SEXP dTestC(SEXP dblX, SEXP funFn, SEXP dots, SEXP rho){ SEXP retVal; SEXP R_fcall; PROTECT(retVal = NEW_NUMERIC(1)); PROTECT(R_fcall = lang3(funFn, R_NilValue, R_NilValue)); SETCADR(R_fcall, dblX); SETCADDR(R_fcall, dots); retVal = eval(R_fcall, rho); UNPROTECT(2); return(retVal); } ######################## When I call the dTest() function, the first required argument and the first optional argument are both used, but not...
2019 Nov 01
0
[External] R C api for 'inherits' S3 and S4 objects
...mbol))) { > for (int i=0; i<LENGTH(klass); i++) { > if (STRING_ELT(klass, i) == char_) return true; > } > } > return false; > } > // S4 inheritance > bool Rinherits(SEXP x, SEXP char_) { > SEXP vec = PROTECT(ScalarString(char_)); > SEXP call = PROTECT(lang3(sym_inherits, x, vec)); > bool ans = LOGICAL(eval(call, R_GlobalEnv))[0]==1; > UNPROTECT(2); > return ans; > } > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Luke Tierney...
2019 Nov 01
0
[External] R C api for 'inherits' S3 and S4 objects
...if (STRING_ELT(klass, i) == char_) return true; >>> } >>> } >>> return false; >>> } >>> // S4 inheritance >>> bool Rinherits(SEXP x, SEXP char_) { >>> SEXP vec = PROTECT(ScalarString(char_)); >>> SEXP call = PROTECT(lang3(sym_inherits, x, vec)); >>> bool ans = LOGICAL(eval(call, R_GlobalEnv))[0]==1; >>> UNPROTECT(2); >>> return ans; >>> } >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> http...
2012 Sep 28
1
High memory needs [SOLVED]
...ing miss-leaded, and thus killing them. A solution could be to restrict the number of languages when installing glibc-common (which provides the locale-archive file), to have a smaller locale-archive file. This should be possible with: $ echo "%_install_langs <lang1>:<lang2>:<lang3>" >> /etc/rpm/macros.lang $ rpm -e glibc-common --nodeps $ rm /usr/lib/locale/locale-archive $ rpm -i <glibc-common.rpm> I don't know why but we couldn't have glibc-common (2.12-1.80) taking it into account, though. All languages were always installed. I read somewhe...
2008 Apr 24
1
Calling R functions with multiple arguments from C
Hi, I'm writing a C function that has to call a R function with multiple arguments. I've read the relevant section in Writing R Extensions, and searched the R site, mailing lists as well as rseek. I managed to call the function, but I'm now having trouble creating the argument list. I tried to create a pairlist of the arguments and send it to the R function. The R function however