similar to: Advice on good programming practice, lexical scope

Displaying 20 results from an estimated 6000 matches similar to: "Advice on good programming practice, lexical scope"

2018 Apr 02
3
recordPlot/replayPlot not working with saveRDS/readRDS
The documentation for recordPlot says the following: > As of R 3.3.0, it is possible (again) to replay a plot from another R session using, for example, saveRDS and readRDS. However, I haven't been able to save and restore a plot displaylist and have it work within the same R session, using R 3.4.3 or 3.3.3. Here's an example: # Save displaylist for a simple plot
2018 Apr 03
1
[FORGED] recordPlot/replayPlot not working with saveRDS/readRDS
>>>>> Paul Murrell <paul at stat.auckland.ac.nz> >>>>> on Tue, 3 Apr 2018 09:41:56 +1200 writes: > Hi What you are doing "wrong" is loading a recordedplot > into the same session that it was created in. The > saveRDS()/readRDS() works if you save in one R session and > then read in a different R session. The
2004 Jun 24
3
R 1.9.0, special characters in variable names.
Hello all, I upgraded from R 1.8.1 to 1.9.0 (Windows XP), and spotted an odd thing. The last three letters in the Swedish alphabet are ??, ?? and ??. (In case they don't show correctly: they are a with a ring, a with two dots, and o with two dots (HTML: &aring; &auml; &ouml;). When I use these as variable names in a data.frame, odd things happen: In R 1.8.1, ?? (&aring;)
2006 Mar 24
1
R crashes when loading library/package; Windows, Cygwin
Dear list members, This is a question is about building an R package under windows and cygwin. Please bear with me. I have a package in R that compiles well on my stationary computer (WINDOWS NT, R 1.8.1 and prior), and the resulting (package_version).zip file works well there. It contains an R script file and a C file. After installing tools to build the package on my laptop, the package
2015 Jul 02
3
Pregunta sobre RMarkdown
Hola Carlos, creo que no resuelve el problema, de hecho otra de las cosas que no he conseguido aún es generar sencillamente el PDF (con los html para generarlos 1 a 1 sin pb). Siempre suelo obtener el error. Esto me aparece al ejecutar myReport$export(): You may install Pandoc easily with "install.pandoc()" from the "installr" package.Error in Pandoc.convert(fp, format =
2008 Dec 18
2
understanding lexical scope
I am trying to understand the concept of lexical scope in "An Introduction to R" by the R Core development team. I'd appreciate it if someone would explain why the following example does not work: q <- function(y) {x + y}; w <- function(x){q(x)}; w(2); According to the discussion of Scope on page 46, it seems to me that R will interpret the free variable x in q as the
2010 Nov 17
1
Lexical Scope: How does it work?
Let me start by saying that I am a fan of lexical scoping as a way of increasing confidence in your execution models. I am hoping to move from the now thoroughly debunked "wackyscope" model that used to plague many programming languages over to proper lexical scoping in my puppet configs. I''m just having trouble finding documentation of how this works for puppet. I understand
2003 Apr 22
3
lexical scope
Hi everyone another documented feature that was a bit unexpected for me: R> x <- 19 R> f <- function(t){t+x} R> f(100) [1] 119 --as expected: x is visible from within f() ..but... R> g <- function(a){x <- 1e99 ; return(f(a))} R> g(4) [1] 23 --the "x" that is visible from within g() is just 19, which is not the one I expected it to find. R> rm(x)
2015 Jul 02
3
Pregunta sobre RMarkdown
Hola, ¿qué tal? Lo que puedes hacer es que tu fichero Rmd lea el parámetro de un fichero externo. Entonces, creas un script que: 1) Actualice el valor del índice en ese fichero externo. 2) Compile el Rmd y le dé el nombre que te interesa. 3) Vuelva a (1). Salud, Carlos J. Gil Bellosta http://www.datanalytics.com El día 2 de julio de 2015, 16:08, David Duncan <dhduncan1975 en
2002 Aug 06
1
Questions about lexical scope
Dear R-users, The numerical integration example given in Gentleman and Ihaka (2000), "Lexical Scope and Statistical Computing," JCGS, 9, 491-508, is very interesting and helpful in understanding how lexical scope is about. However, I got some questions that I just can't figure out. First all, allow me to copy the two functions given by the authors: midpoint <- function(f, a,
2007 Dec 06
10
Feedback on RC2
I tried to upgrade my existing application to RC2 last night. Like many, I use this mostly for running scheduled tasks. For the moment, I''ve abandoned the effort, but am looking forward to being able to use this. Feedback below: First, the reason I was looking forward to this upgrade was to use the threaded scheduler. I have an application with long-running tasks. I found that
2008 Apr 21
1
Use of recordPlot
I am trying to save plots that I create using calls to windows() folowed by multiple calls to plot to place several plots on a page. I want to store the plots as variables to be able to recall them later. The documentation states: "Recorded plot histories are of class "SavedPlots". They have a print method, and a subset method. As the individual plots are of class
2004 Mar 10
1
Question concerning library function "nlme" and lexical scoping
I am running into problems calling the library function nlme from within another function. Basically,the following function (with v a list containing data and initialization values) > testfunc function(dat=v) { test<-nlsList(result~a+(b-a)/(1+(conc/(c+z*cdiff))^d) |rep,start=dat$init,data=dat$mixeddat) return(nlme(test,random=b~1)) } produces the error message Error in eval(expr, envir,
2023 Mar 18
1
lexical scoping for scripts......
On 18/03/2023 1:57 p.m., akshay kulkarni wrote: > Dear members, > The documentation for source() says: > > Input is read and parsed from that file until the end of the file is reached, then the parsed expressions are evaluated sequentially in the chosen environment. > > What does this mean? I presume that any objects that are CREATED by the script
2023 Mar 18
1
lexical scoping for scripts......
Dear members, The documentation for source() says: Input is read and parsed from that file until the end of the file is reached, then the parsed expressions are evaluated sequentially in the chosen environment. What does this mean? I presume that any objects that are CREATED by the script are stored in the Global environment (if local = FALSE), but the rules for
2003 Feb 28
2
Lexical scoping question
Hello, Could someone please tell me what I am thinking about incorrectly: f <- function(y) { g <- function(x) x + y g } In the following, I get what I expect based on my understanding of lexical scoping: (f(1))(3) # 4 (f(2))(3) # 5 But now, fs <- lapply(c(1, 2), f) fs[[1]](3) # 5 (Why not 4 ?) fs[[2]](3) # 5 Checking the environments of these functions, I see that
2023 Apr 04
1
on lexical scoping....
?search and ?environment See also "The R Language Definition" manual for similar such questions. -- Bert On Tue, Apr 4, 2023 at 6:56?AM akshay kulkarni <akshay_e4 at hotmail.com> wrote: > > Dear Members, > I have the following code typed at the console prompt: > > y <- x*10 > > X has not been defined and the above code
2023 Mar 19
1
lexical scoping for scripts......
Dear Duncun, thanks for the reply.... So when I run a script in the system command line by R CMD BATCH, the objects created in the script cannot be stored in the workspace ,right? If yes, how to save them? Moreover, the only way to save the objects CREATED from the script permanently is to save them to the disk, right? THanking you, yours sincerely, AKSHAY M KULKARNI
2013 Sep 24
1
recordPlot() on non-interactive graphics device?
Hi. Q. Is there a way to record a plot using grDevices::recordPlot() without opening an interactive (=visible GUI window) graphics device (not even for a flash of a second)? Related: help("recordPlot", package="grDevices") says: "These functions record and replay the displaylist of the current graphics device." Is the intention that recordPlot() should be able to
2004 Jul 28
2
Simulation from a model fitted by survreg.
Dear list, I would like to simulate individual survival times from a model that has been fitted using the survreg procedure (library survival). Output shown below. My plan is to extract the shape and scale arguments for use with rweibull() since my error terms are assumed to be Weibull, but it does not make any sense. The mean survival time is easy to predict, but I would like to simulate