Displaying 6 results from an estimated 6 matches for "mycondit".
Did you mean:
condit
2015 Feb 23
5
iterated lapply
...n
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 feature?
conditions <- 1:4
test <- lapply(conditions, function(mycondition){
#print(mycondition)
myfn <- function(i) mycondition*i
return(myfn)
})
sapply(test, function(myfn) myfn(2))
Cheers,
Daniel
--
Daniel Kaschek
Institute of Physics
Freiburg University
Room 210
Phone: +49 761 2038531
2015 Feb 24
3
iterated lapply
...; ... 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){
> #print(mycondition)
> myfn <- function(i) mycondition*i
> return(myfn)
> })
>
> sapply(test, function(myfn) myfn(2))
From: Jeroen Ooms <jeroenooms at gmail.com>
> I think it is a bug. If we use substitute to inspect the promise, it
> appears the index...
2015 Feb 23
0
iterated lapply
...evaluation when you want it.
This is a feature: it allows you to have arguments that are never
evaluated, because they are never used, or defaults that depend on
things that are calculated within the function.
Duncan Murdoch
> conditions <- 1:4
> test <- lapply(conditions, function(mycondition){
> #print(mycondition)
> myfn <- function(i) mycondition*i
> return(myfn)
> })
>
> sapply(test, function(myfn) myfn(2))
>
>
>
> Cheers,
> Daniel
>
2015 Feb 24
0
iterated lapply
...his 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){
>> #print(mycondition)
>> myfn <- function(i) mycondition*i
>> return(myfn)
>> })
>>
>> sapply(test, function(myfn) myfn(2))
>
> From: Jeroen Ooms <jeroenooms at gmail.com>
>> I think it is a bug. If we use substitute to inspect th...
2015 Feb 26
3
iterated lapply
...>>> 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){
>>> #print(mycondition)
>>> myfn <- function(i) mycondition*i
>>> return(myfn)
>>> })
>>>
>>> sapply(test, function(myfn) myfn(2))
>>>
>>
>> From: Jeroen Ooms <jeroenooms at gmail.com>
>>
>>&g...
2003 Dec 05
0
simple sphericity test using bartlett and cov?
Hey,
Is this right for a sphericity test?
x <- mymatrix
mycov <- cov(x)
bartlett.text (array (mycov), myconditions)