Displaying 20 results from an estimated 50000 matches similar to: "lapply sequence"
2011 Mar 10
2
within group sequential subtraction
Hi Everyone,
I would like to do sequential subtractions within a group so that I know the
time between separate observations for a group of individuals.  
My data:
data <- structure(list(group = c("IND1", "IND1", "IND2", 
"IND2", "IND2", "IND3", "IND4", "IND5", 
"IND6", "IND6"), date_obs =
2018 Jun 05
3
Unit Tests CMake configuration
Hi llvm-dev,
Does anybody know why we're not using the `add_test` feature in CMake
[0] for unit tests? In particular, compiler-rt (sanitizers and xray)
has a number of unit tests which could really just be built as normal
binaries and invoked appropriately.
If we're avoiding ctest [1], then for the unit tests in compiler-rt
I'd like to see whether just using normal binaries can make
2012 Aug 07
2
What is this called? lapply(datum,"[[","ColumnName")
Hello R users
I recently learned how to use this command:
lapply(datum,"[[","ColumnName")
 
Unfortunately, I don't know how exactly it works, what it's called (in
particular the "[[" part], and what other things you can do with it
(retrieve multiple columns?).
Given datum is a list of dataframes with the same column, but different
number of rows,
 
2011 Mar 30
4
a for loop to lapply
Dear all,
I am trying to learn lapply.
I would like, as a test case, to try the lapply alternative for the 
Shadowlist<-array(data=NA,dim=c(dimx,dimy,dimmaps))
for (i in c(1:dimx)){
    Shadowlist[,,i]<-i
}
---so I wrote the following---
returni <-function(i,ShadowMatrix) {ShadowMatrix<-i}
lapply(seq(1:dimx),Shadowlist[,,seq(1:dimx)],returni)
So far I do not get same results
2013 Jun 07
1
[LLVMdev] [cfe-dev] Meaning of LLVM optimization levels
Of course it's *possible*, in a fundamental sense. It's even pretty easy to get right in a compiler back end (in a conceptual sense). You have to touch a LOT of code, but all the changes are trivial.  We did this at Tartan Labs back in the 90s. Done with only a bit of care, it makes debugging possible at any optimization level.  The idea is to make the debug information reflect what the
2014 Jun 23
1
Curious behavior of $ and lapply
There seems to be a funny interaction between lapply and "$" -- also, "$"
doesn't signal an error in some cases where "[[" does.
The $ operator accepts a string second argument in functional form:
> `$`(list(a=3,b=4),"b")
[1] 4
lapply(list(list(a=3,b=4)),function(x) `$`(x,"b"))
[[1]]
[1] 4
... but using an lapply "..."
2008 Sep 09
2
make methods work in lapply - remove lapply's environment
I've defined my own version of summary.default,
that gives a better summary for highly skewed vectors.
If I call
  summary(x)
the method is used.
If I call
  summary(data.frame(x))
the method is not used.
I've traced this to lapply; this uses the new method:
  lapply(list(x), function(x) summary(x))
and this does not:
  lapply(list(x), summary)
If I make a copy of lapply, WITHOUT the
2017 Nov 15
0
lapply and runif issue?
Hi Bert,
On Tue, Nov 14, 2017 at 8:11 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Could someone please explain the following? I did check bug reports, but
> did not recognize the issue there. I am reluctant to call it a bug, as it
> is much more likely my misunderstanding. Ergo my request for clarification:
>
> ## As expected:
>
>> lapply(1:3, rnorm, n = 3)
2005 Oct 10
2
problem with lapply(x, subset, ...) and variable select argument
I need to extract identically named columns from several data frames in 
a list. the column name is a variable (i.e. not known in advance). the 
whole thing occurs within a function body. I'd like to use lapply with a
variable 'select' argument.
example:
tt <- function (n) {
    x <- list(data.frame(a=1,b=2), data.frame(a=3,b=4))
    for (xx in x) print(subset(xx, select = n))
2013 Mar 13
2
holding argument(s) fixed within lapply
|Hello,
Given a function with several arguments, I would like to perform an
lapply (or equivalent) while holding one or more arguments fixed to some
common value, and I would like to do it in as elegant a fashion as
possible, without resorting to wrapping a separate wrapper for the
function if possible. Moreover I would also like it to work in cases
where one or more arguments to the original
2009 Aug 11
1
Passing a list object to lapply
Hello,
I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?
#Works
T13702 <- TRACKDATA[["13702.xls"]][["data"]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]))))
16553
#Works
d<-2
assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
2012 Dec 11
2
debug on lapply
Dear R experts,
recently I tried to debug a R function with an internal lapply call.
When debugging I seem not to be able to use the "n" command to debug the
inner function called by lapply.
How could I achieve this?
*For example:*
test <- function( ) {
  lapply( 1:3, function( x ) x + 1 )
}
debug( test )
*Start debug:*
> test()
debugging in: test()
debug bei #1:{
   
2008 Jan 31
2
Pb with lapply()
Hi,
If needed, lapply() tries to convert its first argument into a list
before it starts doing something with it:
  > lapply
  function (X, FUN, ...) 
  {
    FUN <- match.fun(FUN)
    if (!is.vector(X) || is.object(X)) 
        X <- as.list(X)
    .Internal(lapply(X, FUN))
  }
But in practice, things don't always seem to "work" as suggested by
this code (at least to the
2009 Aug 17
1
how to pass more than one argument to the function called by lapply?
Dear R helpers:
I wonder how to pass more than one argument to the function called by
lapply.
For example,
#R code below ---------------------------
indf <- data.frame(id=I(c('a','b')),y=c(1,10))
#I want to add an addition argument cutoff into the function called by
lapply.
outside.fun <- function(indf, cutoff)
{
 unlist(lapply(split(indf, indf[,'id']),
2012 Sep 11
1
lapply with different size lists?
Hello,
I have 2 functions (a and b)
a = function(n) { matrix (runif(n*2,0.0,1), n) }
>
>
> b = function (m, matrix) {
>         n=nrow (matrix)
>         p=ceiling (n/m)
>         lapply (1:p, function (l,n,m) {
>                         inf = ((l-1)*m)+1
>                         if (l<p) sup=((l-1)*m)+m
>                                 else sup=n
>            
2010 Sep 21
2
lapply version with [ subseting - a suggestion
Dear R developers,
Reviewing my code, I have realized that about 80% of the time in the lapply I
need to access the names of the objects inside the loop.
In such cases I iterate over indexes or names:
lapply(names(x), ... [i]), 
lapply(seq_along(x),  ... x[[i]] ... names(x)[i] ), or
for(i in seq_along(x)) ...
which is rather inconvenient.
How about an argument to lapply which would specify the
2009 Dec 08
2
could not find function lapply<-
R-help,
I have a list whose elements are data frames.
I want to change the colnames attribute in each element of this list but an error message
comes up:
> lapply(LD_strataNew,function(x) dimnames(x)[[2]][-1]) <- as.roman(1:9)[-6]
Error in lapply(LD_strataNew, function(x) dimnames(x)[[2]][-1]) <- as.roman(1:9)[-6] : 
  could not find function "lapply<-"
>
2010 Oct 15
1
Downloading file with lapply
I'm still getting familiar with lapply
I have this date sequence
x <- seq(as.Date("01-Jan-2010",format="%d-%b-%Y"), Sys.Date(), by=1) #to
generate series of dates
I want to apply the function for all values of x . so I use lapply (Still a
newbie!)
I wrote this test function
pFun <- function (x) {
  print(paste("This is: ",x,sep=""))
  }
When I
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
2007 Aug 15
1
getting lapply() to work for a new class
Hi,
I would like to get lapply() to work in the natural way on a class I've
defined. As far as I can tell, lapply() needs the class to be coercible
to a list. Even after I define as.list() and as.vector(x, mode="list")
methods, though, I still get an "Error in as.vector(x, "list") : cannot
coerce to vector". What am I doing wrong?
# dummy class