search for: defmacro

Displaying 20 results from an estimated 29 matches for "defmacro".

2012 Jan 12
2
defmacro installation issue
Hi everybody, I want to use macro in my R code. But defmacro was not in my libraries. So I installed it : > install.packages("gtools") Installing package(s) into ?C:/Program Files/R/R-2.13.2/library? (as ?lib? is unspecified) essai de l'URL 'http://cran.cict.fr/bin/windows/contrib/2.13/gtools_2.6.2.zip' Content type 'application...
2012 Dec 09
1
defmacro and bwplot incompatibilities?
My macro doesn't work for bwplot. But is working elsewhere. What changes should i make to fix my macro. Thanks. The complete code sample is: library(gtools) library(lattice) pic <- defmacro(fn, plotfunc, expr={png(filename=fn); plotfunc; dev.off()}) # this one fails. pic("bw.png", {bwplot(Species ~ Sepal.Length, data=iris)}) # this one works pic("p.png", {plot(iris$Sepal.Length)}
2012 Aug 31
1
loading 'RcmdrPlugin.FactoMineR' pachage in R
...############################################## local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Attaching package: 'RcmdrPlugin.FactoMineR' The following object(s) are masked _by_ '.GlobalEnv': ??? defmacro, FactoAFDM, FactoCA, Factocatdes, FactoDMFA, FactoGPA, ??? FactoHCPC, FactoHMFA, FactoMCA, FactoMFA, FactoPCA, Factoprefpls, ??? readDataSetFacto The following object(s) are masked from 'package:Rcdr': ??? defmacro ############################################################################...
2004 Jun 09
1
Using macros
...e (perhaps because I've not been clever enough to do it in a natural way). Thomas Lumley describes a function for constructing R "macros" in the Sept. 2001 issue of R-news. Here's an application to producing standard OK, Cancel, and Help buttons using tcltk: ### Thomas's defmacro: defmacro <- function(..., expr){ expr <- substitute(expr) a <- substitute(list(...))[-1] ## process the argument list nn <- names(a) if (is.null(nn)) nn <- rep("", length(a)) for (i in seq(length=length(a))){...
2012 May 03
1
Help with getting values from string
.... I used macros and i try to pass a value to a macro by concatenating a bunch of strings. But it does not seem to work. Please help. I have written down my code and the error message please tell me how to pass the value that a string points to. Thanks in advance #macro defined machist_occ_kgfs<-defmacro(a,qnu_occ,b,qnl_occ,expr={with(subset(an_ind_data_fin,income_source==a & region_id==b & normalised_income>qnl_occ & normalised_income<qnu_occ),hist(normalised_income,main=paste(a,b,sep=" ")))}) #macro called machist_occ_kgfs(occ,paste("qnu",ri,occ,collapse=&quo...
2014 Nov 11
4
Evaluar como texto un parámetro de mi función
...lt;-rnorm(10,3) datos.B<-rnorm(100,30) datos.C<-rnorm(1000,300) datos.D<-rnorm(10000,3000) describe <- function(letra){ summary(datos.letra) } describe(B) Quiero que haga summary(datos.B) y no soy capaz. Nunca me había visto en una situación parecida. Tampoco resuelvo mi problema con defmacro de gtools. Muchas gracias, un saludo. Raúl Vaquerizo Romero www.analisisydecision.es
2005 Aug 31
2
R CMD check example problem (PR#8113)
[Automatic forwarding from R-bugs failed. This message has been manually forwarded.] Hi all! I'm trying to add Thomas Lumley's defmacro() function Lumley T. "Programmer's Niche: Macros in {R}", R News, 2001, Vol 1, No. 3, pp 11--13, \url{http://CRAN.R-project.org/doc/Rnews/} to the gtools package (provided that Thomas gives his OK). And I've encountered an error in how R CMD check is extracting the example code...
2005 Oct 03
2
access to R parse tree for Lisp-style macros?
R folks, I'm curious about possible support for Lisp-style macros in R. I'm aware of the "defmacro" support for S-Plus and R discussed here: http://www.biostat.wustl.edu/archives/html/s-news/2002-10/msg00064.html but that's really just a syntactic short-cut to the run-time use of substitute() and eval(), which you could manually put into a function yourself if you cared too. (AKA,...
2012 Jan 12
2
is there an equivalent for #ifdef (C langage) in R
Hi, I'd like to know if there is an equivalent for #ifdef (Clangage) in R. I 'd like to do something like: useDebug = defmacro(DEBUG, expr=(DEBUG==1)) if(useDebug(0)){ #Here I do not use debug mode make_addition = function(a, b) { c=a+b plot(c) return(c) } }else{ #here I use debug mode c=a+b } I assume this would work... The problem is : if I have 15 lines of code in if{ } blo...
2015 Jul 02
3
[LLVMdev] MCJIT or ORC JIT for new project?
...uage in addition to compiling. 3) While compiling, be able to execute arbitrary code at compile time. The simple case will be to get a value, similar to C++ constexpr but without any restrictions. The complicated case will be to support a full macro system similar to syntax-rules in Racket or defmacro in Lisp. For (1) I would require being able to execute a function at a time. I would also like to be able to discard temporary functions used just to get a value. For (2) and (3) lazy compilation is required, catching the results would also be great. For right now I plan to use a direct AST b...
2013 Mar 13
2
holding argument(s) fixed within lapply
...||| )||| |||| |||# errors out again||| |||ret2 <- lapply(FUN = eval,||| ||| X = mylist2,||| ||| expr = substitute(f2(w, y = Y, z))||| ||| )|| || ||# not quite...|| ||ret2 <- lapply(FUN = gtools::defmacro(y = Y, expr = f2(w, y = Y, z)),|| || X = mylist2|| || )| || |It seems like there are many ways to skin this cat; open to any and all guidance others care to offer. ||| |Regards, Ben |
2009 Dec 26
3
something similar to %include() in sas?
i am just wondering if there is an effective way to include other external codes into the program. thanks. [[alternative HTML version deleted]]
2005 Apr 23
1
tclServiceMode: stop Tcl/Tk from updating
In Windows, Tcl/Tk programs running under the tcltk package can update too frequently: for exmaple, we might go through a long sequence of operations to construct a complex display, and in Windows each addition will be shown separately. To work around this, I've added a function "tclServiceMode" which serves as an R interface to the "Tcl_SetServiceMode" function in the
2012 Feb 28
2
Error: could not find function "hier.part"
...;, I get (hier.part is not included): > gtools:: <TAB> gtools::addLast gtools::ask gtools::assert gtools::binsearch gtools::capture gtools::checkRVersion gtools::combinations gtools::ddirichlet gtools::defmacro gtools::even gtools::foldchange gtools::foldchange2logratio gtools::inv.logit gtools::invalid gtools::keywords gtools::logit gtools::logratio2foldchange gtools::mixedorder gtools::mixedsort gtoo...
2009 Dec 10
2
global variables in a function
Y'all, I would like to have most of the variables in my function to be global instead of local. I have not found any references that tell me now to do that. If I have missed a reference please excuse me and tell me what I have missed. Thanks, Keith Jones
2008 Mar 27
1
[LLVMdev] Hooking the global symbol resolver
On Wed, 2008-03-26 at 23:48 +0100, Óscar Fuentes wrote: > "Jonathan S. Shapiro" <shap at eros-os.com> writes: > My front-end is very similar to yours in the feature of the multiple > instantiations on demand, etc. Oscar: after you have a chance to read my recent reply to Gordon, would you be kind enough to let me know whether you still believe the situations are similar.
2013 Jan 31
2
use name (not values!) of a dataframe inside a funktion
Dear Listers, can anyone help me, please. Since several days i try to figure out, how to assign values, vectors, functions etc to variables with dynamically generated names inside of functions. Sometimes I succeed, but the success is rather arbitrary, it seems. up to now i don't fully understand, why things like get, assign, <<- etc do sometimes work, and sometimes not. here's one
2011 Nov 08
3
lapply to list of variables
Hi Can someone help me with this? How can I apply a function to a list of variables. something like this listvar=list("Monday","Tuesday","Wednesday") func=function(x){x[which(x<=10)]=NA} lapply(listvar, func) were Monday=[213,56,345,33,34,678,444] Tuesday=[213,56,345,33,34,678,444] ... in my case I have a neverending list of vectors. Thanks!
2007 Nov 15
1
Writing a helper function that takes in the dataframe and variable names and then does a subset and plot
Hi, I have a large dataframe than I'm writing functions to explore, and to reduce cut and paste I'm trying to write a function that does a subset and then a plot. Firstly, I can write a wrapper around a plot: plotwithfits <- function(formula, data, xylabels=c('','')) { xyplot(formula, data, panel = function(x,y, ...) { panel.xyplot(x,y,
2018 Feb 21
4
Is there socksify script for dynamics forwardings to unix domain sockets?
Am Di, 20. Feb 2018, 23:13:16 -0800 schrieb Dan Kaminsky: > Date: Tue, 20 Feb 2018 23:13:16 -0800 > From: Dan Kaminsky <dan at doxpara.com> > To: J? Fahlke <jorrit at jorrit.de> > Cc: openssh-unix-dev at mindrot.org > Subject: Re: Is there socksify script for dynamics forwardings to unix > domain sockets? > > Whoa. That's pretty cool. > >