similar to: returning functions inside lapply

Displaying 20 results from an estimated 10000 matches similar to: "returning functions inside lapply"

2012 Oct 09
2
plot.new() and grid functions in multipage pdfs
Hi, when using the grid package, I've come across this weird behaviour where a call to plot.new() will start a new page for a multi-page pdf, but then the margins will somehow behave strangely for all but the first page: here is some code: pdf("test.pdf"); plot.new(); grid.rect(gp = gpar(fill="blue")); plot.new(); grid.rect(gp = gpar(fill="blue")); dev.off()
2010 Mar 12
2
Redirect/pipe output to less
I'm using R under Linux. Since the help function in R can use the program less to display text, I'd like to know if it is possible for a user to do the same. It would be very helpful to be able to view large objects (matrices/dataframes etc) using less. This is preferable to redirecting output to file or to clutter the workspace with too much output. I have tried to use functions pipe and
2012 Feb 07
2
predict.naiveBayes() bug in e1071 package
Hi, I'm currently using the R package e1071 to train naive bayes classifiers and came across a bug: When the posterior probabilities of all classes are small, the result from the predict.naiveBayes function become NaNs. This is an issue with the treatment of the log-transformed probabilities inside the predict.naiveBayes function. Here is an example to demonstrate the problem (you might need
2010 Mar 04
3
Is it possible to recursively update a function?
Here is the test code. foo<-function(x) exp(-x) for (i in 1:5) { foo<-function(x) foo(x)*x foo(2) } The error is "evalution nested too deeply". I tried Recall() but it didn't work either. Thanks a lot for your input.
2005 Jan 13
1
ASTCC dimensioning
hello there, any one who used ASTCC in a real enviroment, or has successfully handled above 1k simultanous calls. need some evalution of ASTCC. if any one has such an experience please share it with the rest thank you Atif
2015 Feb 25
1
performance issue with large group and dbcheck / dc join
Hi everyone, yesterday I had to debug a failing join on a large domain for a group of primary schools with 1000+ desktop and 10k accounts. The domain run mostly ok except for some replications issues, however joining a new DC just takes eons and so does dbcheck. After some investigation into dbcheck (4.1.17) and some "human powered" valgrind like evalution using pudb, I came to the
2017 Jul 31
0
force promises inside lapply
quote(expr) will make no changes in expr, it just returns its one argument, unevaluated. substitute could be used in your lapply(..., library) example to give library a name instead of a character string for an input (which might be necessary if the character.only argument were not available) lapply(c("MASS", "splines"), function(pkg) eval(substitute(library(pkg),
2007 Dec 22
2
Understanding eval
After many hours of debugging code, I came to the conclusion that I have a fundamental misunderstanding regarding eval, and hope that someone here can explain to me, why the following code acts as it does: foo <- function(expr) { eval(substitute(expr), envir=list(a=5), enclos=parent.frame()) } bar <- function(er) { foo(er) } > foo(a) [1] 5 > bar(a) Error in eval(expr,
2018 May 03
1
The stages of standard function evaluation
Dear R Help folks -- I have been trying to put together a list of the steps or stages of R function evaluation, with particular focus on those that have "standard" or "nonstandard" forms. This is both for my own edification and also because I am thinking of joining the world of R bloggers and have been trying to put together some draft posting that might be useful. I seem to
2011 Sep 15
2
Returning the name of an object passed directly or from a list by lapply
Dear folks: Let?s suppose I want a function to print return the name of the object passed to it. > myname <- function(object) {out<-deparse(substitute(object)); out} This works fine on a single object: > O1 <-c(1:4) > myname(O1) [1] "O1" However it does not work if you use lapply to pass it the same object from a list: > O2 <-c(1:4) > object.list <-
2019 Dec 14
2
Inconsistent behavior for the C AP's R_ParseVector() ?
Le lun. 9 d?c. 2019 ? 09:57, Tomas Kalibera <tomas.kalibera at gmail.com> a ?crit : > On 12/9/19 2:54 PM, Laurent Gautier wrote: > > > > Le lun. 9 d?c. 2019 ? 05:43, Tomas Kalibera <tomas.kalibera at gmail.com> a > ?crit : > >> On 12/7/19 10:32 PM, Laurent Gautier wrote: >> >> Thanks for the quick response Tomas. >> >> The same error
2014 Mar 17
1
Samba 4.1 Active Directory and Windows 2012 Standard Evaluation
Hi all, I've been slowly coming to grips with ActiveDirectory, having set up a test network to figure out its innards and rehearse setting up a network in preparation of replacing our existing NT4-based domain. One of the machines I'm trying to join as a member server, is running Windows 2012 Standard Evaluation. It's actually an OpenStack image retrieved from here:
2008 Apr 11
2
conditioning inside an lapply
This is probably basic but I want to condition based on the name of the component inside an lapply. So, in the simple example below, if .elem was x i want to do one thing but if it's y a different thing etc. Can someone tell me how to do that without using names(temp) as the thing one sends into the lapply ? Thanks. temp <- list(x=2,y=3,x=4) invisible(lapply(temp, function(.elem) {
2008 Sep 04
2
printing name of object inside lapply
Dear list members, I am trying, within a lapply command, to print the name of the objects in list or data frame. This is so that I can use odfWeave to print out a report with a section for each object, including the object names. I tried e.g. a=b=c=1:5 lis=data.frame(a,b,c) lapply( lis, function (z) { obj.nam <- deparse(substitute(z)) cat("some other text",obj.nam,"and so
2004 Nov 19
2
accessing the attributes of a list inside lapply()
Hello R-users, I have the following problem, that I want to solve efficiently: I have a named list, for example: > l <- list(a = 1, b = 3, c = 'asd') > l $a [1] 1 $b [1] 3 $c [1] "asd" I know that I can iterate through it using lapply() function, but I would also like to able to get the list names or some attributes of l in the lapply(). For example if I use
2019 Dec 09
3
Inconsistent behavior for the C AP's R_ParseVector() ?
Le lun. 9 d?c. 2019 ? 05:43, Tomas Kalibera <tomas.kalibera at gmail.com> a ?crit : > On 12/7/19 10:32 PM, Laurent Gautier wrote: > > Thanks for the quick response Tomas. > > The same error is indeed happening when trying to have a zero-length > variable name in an environment. The surprising bit is then "why is this > happening during parsing" (that is why
2007 Aug 15
3
Formula in lm inside lapply
I am trying to run separate regressions for different groups of observations using the lapply function. It works fine when I write the formula inside the lm() function. But I would like to pass formulae into lm(), so I can do multiple models more easily. I got an error message when I tried to do that. Here is my sample code: #generating data x1 <- rnorm(100,1) x2 <- rnorm(100,1) y <-
2019 Dec 14
1
Inconsistent behavior for the C AP's R_ParseVector() ?
Hi Simon, Widespread errors would have caught my earlier as the way that code is using only one initialization of the embedded R, is used quite a bit, and is covered by quite a few unit tests. This is the only situation I am aware of in which an error occurs. What is a "correct context", or initial context, the code should from ? Searching for "context" in the R-exts manual
2002 Apr 03
0
Another question on locfit
Hello!!! Thank you all for your suggestion on my last question about locfit. Now I have another question: I would like to change the evalution structure ev in locfit() to a vector/matrix. I created a vector and a matrix: > vec <- mat.or.vec(101, 1) > vec <- c(0:100) > mat <- matrix(data = vec, nrow = 101, ncol = 1) and I tried to change the ev parameter: > fit <-
2005 Jul 12
0
Returning values from macro inside Dial command
I'd like to set some variables inside the macro called from Dial(). As far as I can tell, though, if you just do a SetVar inside the macro, it's set in a different context and isn't available to the code that calls the macro. Am I missing something? What's the right way to return data from the macro call? (Other than the MACRO_RESULT feature.) I'm using the