[R] A question on list and lapply
    Christofer Bogaso 
    bogaso.christofer at gmail.com
       
    Fri Dec 14 19:58:18 CET 2012
    
    
  
Dear all, let say I have following list:
Dat <- vector("list", length = 26)
names(Dat) <- LETTERS
My_Function <- function(x) return(rnorm(5))
Dat1 <- lapply(Dat, My_Function)
However I want to apply my function 'My_Function' for all elements of 
'Dat' except the elements having 'names(Dat) == "P"'. Here I have 
specified the name "P" just for illustration however this will be some 
name specified by user.
Is there any direct way to achieve this, using 'lapply'?
Thanks for your help.
    
    
More information about the R-help
mailing list