Displaying 20 results from an estimated 2000 matches similar to: "iterated lapply"
2015 Feb 24
3
iterated lapply
From: Daniel Kaschek <daniel.kaschek at physik.uni-freiburg.de>
> ... When I evaluate this list of functions by
> another lapply/sapply, I get an unexpected result: all values coincide.
> However, when I uncomment the print(), it works as expected. Is this a
> bug or a feature?
>
> conditions <- 1:4
> test <- lapply(conditions, function(mycondition){
>
2015 Feb 26
3
iterated lapply
Would introducing the new frame, with the call to local(), cause problems
when you use frame counting instead of <<- to modify variables outside the
scope of lapply's FUN, I think the frame counts may have to change. E.g.,
here is code from actuar::simul() that might be affected:
x <- unlist(lapply(nodes[[i]], seq))
lapply(nodes[(i + 1):(nlevels - 1)],
2015 Feb 24
0
iterated lapply
The documentation is not specific enough on the indented semantics in
this situation to consider this a bug. The original R-level
implementation of lapply was
lapply <- function(X, FUN, ...) {
FUN <- match.fun(FUN)
if (!is.list(X))
X <- as.list(X)
rval <- vector("list", length(X))
for(i in seq(along = X))
rval[i]
2015 Feb 23
0
iterated lapply
On 23/02/2015 3:57 PM, Daniel Kaschek wrote:
> Hi everybody,
>
> with the following code I generate a list of functions. Each function
> reflects a "condition". When I evaluate this list of functions by
> another lapply/sapply, I get an unexpected result: all values coincide.
> However, when I uncomment the print(), it works as expected. Is this a
> bug or a
2015 Feb 24
2
iterated lapply
> On Feb 24, 2015, at 10:50 AM, <luke-tierney at uiowa.edu> wrote:
>
> The documentation is not specific enough on the indented semantics in
> this situation to consider this a bug. The original R-level
> implementation of lapply was
>
> lapply <- function(X, FUN, ...) {
> FUN <- match.fun(FUN)
> if (!is.list(X))
> X <-
2015 Feb 26
1
iterated lapply
> On Feb 25, 2015, at 5:35 PM, Benjamin Tyner <btyner at gmail.com> wrote:
>
> Actually, it depends on the number of cores:
Under current semantics, yes. Each 'stream' of function calls is lazily capturing the last value of `i` on that core.
Under Luke's proposed semantics (IIUC),
the result would be the same (2,4,6,8) for both parallel and serial execution. This is
2015 Feb 25
0
iterated lapply
Actually, it depends on the number of cores:
> fun1 <- function(c){function(i){c*i}}
> fun2 <- function(f) f(2)
> sapply(mclapply(1:4, fun1, mc.cores=1L), fun2)
[1] 8 8 8 8
> sapply(mclapply(1:4, fun1, mc.cores=2L), fun2)
[1] 6 8 6 8
> sapply(mclapply(1:4, fun1, mc.cores=4L), fun2)
[1] 2 4 6 8
> >/ On Feb 24, 2015, at 10:50 AM,
2011 Mar 15
2
how to set the starting value in lme
Hi,
When I fit the mixed-effects model by lme, I got the convergence error code = 1
message = iteration limit reached without convergence (9). Even after I increase the iteration numbers, it still did not work. The only way I found to avoid the error message is to increase the number of iterations for the EM algorithm, which need to be at least 1100. But the weird thing is that the correlation
2011 Mar 15
1
precompiled ode with spline input
I tried to use lsode with precompiled C code instead of an R function
defining the derivatives. No problem so far.
However, now I need to implement an ODE that contains spline functions,
i.e. the derivatives at given time points depend on the value of a
spline function at this time point. What is an efficient way to
implement this in precompiled C code?
--
Daniel Kaschek <daniel.kaschek at
2008 Jul 17
2
nested calls, variable scope
Below is an example of a problem I encounter repeatedly when I write functions. A call works at the command line, but it does not work inside a function, even when I have made sure that all required variables are available within the function. The only way I know to solve it is to make the required variable global, which of course is dangerous. What is the elegant or appropriate way to solve
2016 Jan 15
1
Multiple cores are used in simple for loop
Dear Martyn,
On Fr, Jan 15, 2016 at 4:01 , Martyn Plummer <plummerm at iarc.fr> wrote:
>
> Alternatively, you may be able to control the maximum number of
> threads
> by setting and exporting an appropriate environment variable depending
> on what backend you are using, e.g. OPENBLAS_NUM_THREADS or
> MKL_NUM_THREADS.
Thanks a lot. Running
export OPENBLAS_NUM_THREADS
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
Hi Óscar,
Thank you for your prompt reply. Unfortunately, I still need more guidance
as using the Demo page to generate C++ code didn't result in a global
variable being used.
Basically, I'm following your advice to use a LoadInst:
Value *v = new LoadInst(result, "", theBasicBlock);
Function *myfn = cast<Function>(v);
I was not sure how I could get a BasicBlock for the
2002 Apr 26
1
optim or nlm with matrices
Hi,
I have the following hypothetical optimization problem:
-det(t(x-A%*%x1)%*%(x-A%*%x1))
where A,x,x1 are matrices. A coefficients and x and x1 are variable matrices or vectors.
I tried to apply optim and nlm functions but I kept receive the following massage:
Error in A%*%x1 : non-conformable arguments.
The massage appears even the -det() can be calculated and the dimensions are checked.
here
2011 Mar 15
2
Calculate monthly means
I am trying to calculate monthly means by year of phosphates and nitrates from a multi year data set. Can anybody help me out with the most effective way to do this?
My data looks like this:
Collection_Date Test.Name Value
2000-01-24 17:00:00 Phosphate 0.108
2000-01-24 17:00:00 Nitrate 0.037
2001-11-12
2011 Dec 12
2
Problems in building a DLL in 64-bit Windows
I am trying to build a C language DLL and it works well with i386 but when I compile with it substituted
by x64, like the FAQ page says, the result is an error message:
C:/PROGRA~1/R/R-214~1.0/bin/x64/R.ddl: file not recognized : File format not recognized
collect2: ld returned 1 exit status
How can I solve this? The problem is with R 2-14.0 and 2-13.0
The complete source code is
/*
* myfun.c
2010 Mar 05
1
How to parse the arguments from a function call and evaluate them in a dataframe?
Hi,
I would like to write a function which has the following syntax:
myfn <- function(formula, ftime, fstatus, data) {
# step 1: obtain terms in `formula' from dataframe `data'
# step 2: obtain ftime from `data'
# step 3: obtain fstatus from `data'
# step 4: do model estimation
# step 5: return results
}
The user would call this function as:
myfn(formula=myform,
2011 Mar 18
1
Problem with Slope.test function
Hi all,
I need to test the significnce of difference between slopes of two regression lines and regression line with theoretical line. I try to use Slope.test function from emu package,
but an error occured...
library(emu)
d1<-data.frame(P1=c(1,2,3,5,7,8,9,13,14,15),
P2=c(1,2,5,8,11,13,15,15,18,24),
R=c(2,7,8,9,16,21,27,31,33,36)) # First data set
m1<-lm(R~P1+P2+P1*P2,data=d1) # Regr.
2000 Oct 06
1
Formulae with factors that have missing values
Hi All,
I have a formula which has a factor with NAs in it. I wish to keep
these in the model matrix, but the NA information is currently lost (the
rows are kept but the NA gets converted to 0). Any ideas as to how
I can keep NAs in?
e.g.
junk <-
2013 Sep 13
2
[LLVMdev] [lld] Implementing the aliasing feature
On 9/13/2013 6:06 PM, Nick Kledzik wrote:
> On Sep 13, 2013, at 3:35 PM, Shankar Easwaran <shankare at codeaurora.org> wrote:
>> This would work only if an alias is another name for the same symbol(weak symbols).
> I don’t know what that means. Can you clarify?
Doesnt this imply that the alias atom is a zero sized atom ?
>> If what is being aliased is another function
2007 Jan 26
1
bootstrap bca confidence intervals for large number of statistics in one model; library("boot")
Sometimes one might like to obtain pointwise bootstrap bias-corrected,
accelerated (BCA) confidence intervals for a large number of statistics
computed from a single dataset. For instance, one might like to get
(so as to plot graphically) bootstrap confidence bands for the fitted
values in a regression model.
(Example: Chiu S et al., Early Acceleration of Head Circumference in
Children with