similar to: global variables in a function

Displaying 20 results from an estimated 10000 matches similar to: "global variables in a function"

2009 Jun 23
3
subset POSIXct
Hi, I have a data frame with two columns: dt and tf. The dt column is datetime and the tf column is a temperature. dt tf 1 2009-06-20 00:53:00 73 2 2009-06-20 01:08:00 73 3 2009-06-20 01:44:00 72 4 2009-06-20 01:53:00 71 5 2009-06-20 02:07:00 72 ... I need a subset of the rows where the minutes are 53. The hour is immaterial. I can not find a wildcard
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
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/zip' length 102500 bytes (100 Kb)
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]]
2014 Nov 11
4
Evaluar como texto un parámetro de mi función
Compañeros, Una de primero de funciones pero que no soy capaz de resolver. Necesito evaluar como texto el parámetro de mi función. Ejemplo: datos.A<-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
2012 Feb 28
2
Error: could not find function "hier.part"
Error: could not find function "hier.part" things I have tried: 1. reinstall R (lastest version, on windows XP) 2. install package "gtools" 3. include: library(gtools) require(gtools) 4. how I call this function: hier.part(c$Y, xdata, fam = "gaussian", gof = "Rsqu") 5.when I try to check what's in the package "gtools", I get (hier.part is
2008 Jan 05
2
Cumulative sum of vector
Hi, Maybe I have not been looking in the right spot, but, I have not been able to fine a command to automatically calculate the running cumulative sum of a vector. Is there such a command? Example of current code: > eig$values [1] 678.365651 6.769697 2.853783 > prop<-eig$values/sum(eig$values) > prop [1] 0.986012163 0.009839832 0.004148005 >
2007 Oct 25
2
Changing steps on a graphic axes
Hi, I would like to tell R what increments to put the tick marks on an axes, e.g. xlim=seq(-5,5,1). I know that will not work. xlim will only except the beginning and end of the range for the axes. Thanks, Keith jones
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",
2013 Mar 13
2
holding argument(s) fixed within lapply
|Hello, Given a function with several arguments, I would like to perform an lapply (or equivalent) while holding one or more arguments fixed to some common value, and I would like to do it in as elegant a fashion as possible, without resorting to wrapping a separate wrapper for the function if possible. Moreover I would also like it to work in cases where one or more arguments to the original
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,
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
2010 Oct 13
4
Change global env variables from within a function
Hi, I've looked all over for a solution to this, but haven't had much look in specifying what I want to do with appropriate search terms. Thus I'm turning to R-help. In the process of trying to write a simple function to rename individual column names in a data frame, I ran into the following problem: When I rename the columns within my function, I can't seem to get it to
2007 Oct 31
1
Multiple calls to a function
Hi y'all, I wrote two functions; 1) sparsely samples a point pattern and calculates the Clark Evans R value and Z score, 2) calls the first function multiple times using a for loop and generates a histogram. I would like to know if there is a more efficient way of calling the first function other than using the for loop. Any ideas?
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
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!
2008 Nov 12
5
function that uses a variable name as the parameter
Hello dear R people! Several times it occurred to me that a function that uses a variable name as a parameter would be helpful, but I did not find out how to write such a function. I have experience in several programming language, but I did not come across a helpful trick... What I want to have is... a <- 12 # starting value add <- function(variable,increment) { variable <-
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.
2004 Nov 10
4
pix in MS Office
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: wine_weirdness.ppt Type: application/vnd.ms-powerpoint Size: 33792 bytes Desc: wine_weirdness.ppt Url : http://www.winehq.org/pipermail/wine-users/attachments/20041110/d6ae19a2/wine_weirdness.ppt
2010 Jul 27
2
Glm
Hi, Is there any way to estimate a DEPENDENT variable through a GLM/LM model? Suppose I have the linear model: y=a0+a1*x1+a2*x2 (a0=1, a1=0.6, a2=0.8, x1~N(1,1), x2~N(0,1)). The alphas and the auxiliary variables are given and I have to estimate y. The point is if I estimate it, let¹s say algebraically, I get high variances that do not decrease as sample sizes increases... Is the any other way