search for: rapply

Displaying 20 results from an estimated 77 matches for "rapply".

Did you mean: apply
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David, If you are referring to the solution that would be: rapply(list(test), eval, envir = fenv) I thought I explained in the question that the above code does not work. It does not throw an error, but the behavior is no different (at least in the output or result). Using the above code still results in the x object not being stored in fenv on 3.1.2. Dayne On...
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote: > I think rapply() was changed to act like lapply() in this respect. > When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was: if (typeof(o...
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
...>> expressions to modify data.table objects within a function, so I need the >> changes to actually be stored in the given environment. Previously, I used >> code like the following: >> >> test <- list(bquote(x <- 10)) >> fenv <- environment() >> rapply(test, evalq, envir = fenv) >> >> Although the code in the example above is much simpler, it shows the >> problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the >> given environment, fenv. In 3.2.1 the code throws an error: >> >> Error in eval(...
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Bill, Is your conclusion to just update the code and enforce using the most recent version of R? Dayne On Wed, Jul 15, 2015 at 4:44 PM, Dayne Filer <dayne.filer at gmail.com> wrote: > David, > > If you are referring to the solution that would be: > > rapply(list(test), eval, envir = fenv) > > I thought I explained in the question that the above code does not work. > It does not throw an error, but the behavior is no different (at least in > the output or result). Using the above code still results in the x object > not being stored in f...
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Another aspect of the change is (using TERR's RinR package): > options(REvaluators=list(makeREvaluator("R-3.1.3"), makeREvaluator("R-3.2.0"))) > RCompare(rapply(list(quote(function(x)x),list(quote(pi),quote(7-4))), function(arg)typeof(arg))) R version 3.1.3 (2015-03-09) R version 3.2.0 (2015-04-16) [1,] [1] "closure" "double" [1] "language" "symbol" [2,] [3] "double" [3] "lan...
2008 Jun 11
7
applying a function recursively
Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of recursion: > test.list<-list("I"=list("A"=c("a", "b", "c"), "B"=c("d", "e", "f"), "C"=c("g", "h", "i")), +
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
I think rapply() was changed to act like lapply() in this respect. In R-3.1.3 we got rapply(list(quote(1+myNumber)), evalq, envir=list2env(list(myNumber=17))) #[1] 18 rapply(list(quote(1+myNumber)), eval, envir=list2env(list(myNumber=17))) #Error in (function (expr, envir = parent.frame(), enclos = if (is.list(e...
2006 Oct 03
2
maybe use voronoi.findrejectsites?
hi all members, please, i need you help... now a i´m working with veronoi polygons in a area with projections, but i need cut the polygons left. On other words, i need cut the polygons in the worked area. R help say that use the command voronoi.findrejectsites, but in this command i need put the numbers, any way...this command not cut!! do you can help me? Thank you for help me! José Bustos
2003 Dec 03
2
memory leak (PR#5476)
Full_Name: g. schiessler Version: 1.8.1 OS: Windows 2000 Pro Submission from: (NULL) (24.229.106.55) Appears to be memory leak with =RApply("qnorm",K56)*-1 function from within Excel 2000. Have spreadsheet with between 100 and 500 of above references. When spreadsheet first opened system using about 200MB but very quickly grows to over 600MB and appears to be unlimited. Is there another way to run qnorm from within Excel w...
2006 Aug 25
0
zoo: new version 1.2-0
Dear useRs, the new version 1.2-0 of the zoo package for dealing with regular and irregular time series data is available from the CRAN mirrors. This version includes two important changes/enhancements: - rapply() was re-named to rollapply() because from R 2.4.0 on, base R provides a function rapply() for recursive (not rolling) application of functions, which was already described in the Green Book. zoo::rapply() currently still exists for backward compatibility, however, it is flagged as...
2009 Mar 27
0
RExcel rcom Server Loading The Wrong Version of R
Hi, I'm pretty new to R and VERY new to RExcel. I've just finished setting it up and I'm having some problems. My first Issue is that if I attempt to use a function like RApply("sum", A1:A4) from within excel it gives me an error saying "There seems to be no R process connected to the server" I can then see an R Console open up and I get a message saying R Server not available. The weird thing is that the r console that opens up is R 2.7.1 and I did a...
2008 Dec 11
2
is there a way to recursilvely lapply
for a simple example: x <- list() x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5)) x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11)) lapply(x,sum) this fails w/ Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument Just wondering if I have overlooked something obvious. one can also do: lapply(x,lapply,sum) but that assumes that you already know how many levels
2009 Mar 09
1
detecting NULL in recursive lists
Dear R-users, How can I detect a NULL in a recursive list? For a regular list I could use lapply: > lapply(list(x=NULL), is.null) $x [1] TRUE However that doesn't work for structures like list(list(x=NULL)). I tried rapply but it treats NULL as a list and discards them: > rapply(list(a=1, b=list(x=NULL)), is.null) a FALSE Any suggestion? Thank you for your help, Vadim Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential or privileged informat...
2009 Oct 13
7
lapply() reccursively
...s possible to use the lapply() function to alter the value of the input, something in the spirit of : a1<-runif(100) a2<-function(i){ a1[i]<-a1[i-1]*a1[i];a1[i] } a3<-lapply(2:100,a2) Something akin to a for() loop, but using the lapply() infrastructure. I haven't been able to get rapply() to do this. The reason is that the "real" a2 function is a difficult function that only needs to be evaluated if the value of a1[i-1] meets some criteria. Thanks in advance,
2007 Aug 28
7
Excel
A common process when data is obtained in an Excel spreadsheet is to save the spreadsheet as a .csv file then read it into R. Experienced users might have learned to be wary of dates (as I have) but possibly have not experienced what just happened to me. I thought I might just share it with r-help as a cautionary tale. I received an Excel file giving patient details. Each patient had an ID
2012 Jun 26
2
flatten lists
...turn it into a vector because then everything will be casted to character vectors: x <- list(name="Jeroen", age=27, married=FALSE, home=list(country="Netherlands", city="Utrecht")) unlist(x) This function sort of does it: flatlist <- function(mylist){ lapply(rapply(mylist, enquote, how="unlist"), eval) } flatlist(x) However it is a bit slow. Is there a more native way?
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
...I intended previously. Briefly, I am using bquote to generate expressions to modify data.table objects within a function, so I need the changes to actually be stored in the given environment. Previously, I used code like the following: test <- list(bquote(x <- 10)) fenv <- environment() rapply(test, evalq, envir = fenv) Although the code in the example above is much simpler, it shows the problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the given environment, fenv. In 3.2.1 the code throws an error: Error in eval(substitute(expr), envir, enclos) : object 'X'...
2010 Nov 09
3
Row-wise recurive function call
...ave a function that works off EVERY individual ROW to throw a result. Like playFn <- function (x){ + result = ((x$A+6*x$B)/(3*x$C)+20)*x$D + return(result) + } I want to apply the function for every row .... can I use an "apply" function ... tried but not been able to ... e.g. print(rapply(a,playFn)) Please advise. Thanks, S
2013 Mar 12
2
Bugs due to naive copying of list elements
...matrices and arrays): a<-list(c(1,2),c(3,4),c(5,6)) b<-a[2:3] a[[2]][2]<-9 print(b[[1]][2]) Naive copying in mapply.c leads to the following bug: X<-1+1 f<-function(a,b) X A<-mapply(f,c(1,2,3),c(4,5,6),SIMPLIFY=FALSE) print(A) X[1]<-99 print(A) Similar bugs exist in eapply, rapply, and vapply.
2012 Apr 11
3
Question on Counting Factors
Hi, I hope this is not too trivial, but I've had this recurring problem and I think there is super easy solution, just not sure what it is. Please see short example below. ?I would like to get the frequency (counts) of all the variables in a single column (that is easy), but I would also like to return the value 0 for the absence of variables defined in another column. For example: animals