HI,
Assuming the structure is similar to this:
set.seed(15)
list1<-lapply(c(60,120),function(i) 
as.data.frame(matrix(sample(1:100,240,replace=TRUE),nrow=i))) # with 2 list 
elements
 lapply(list1,function(x) x[-c(32,64,96,128,160,192),])
A.K.





----- Original Message -----
From: eliza botto <eliza_bo...@hotmail.com>
To: "r-help@r-project.org" <r-help@r-project.org>
Cc: 
Sent: Wednesday, January 2, 2013 12:00 PM
Subject: [R] loop correction needed


Dear useRs,
i have a data frame with 16 lists in it. each list has variable number of 
lines. i want to create a loop which will start deleting every 32nd line in 
each list, till the end of each list. more precisely if a list has 200 rows i 
want to delete row number 32, 64, 96 and so on...for that i created the 
followng loop.
>e<-lapply(seq(1),function(i) 
>rbind(r[[i]][1:31,],(r[[i]][32:nrow(r[[i]]),][-seq(i,nrow(r[[i]]),32),])))
but this loop executes the desired operation on the list at the top and doesnt 
do anything to the remaining 16 lists.
any help?thanks in advance
eliza                           
    [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to