Hi, I have a list(A1) of dataframe and a vector containing a 22 list names. list(A1) abc l m n p q r dce e g h l k m kpo a d c also i have a vector of list names. abc,dce similarly i have 22 elements. I wanna delete or want a list without the list elements whoes name match up the vector. my result should be kpo a d c. i tried lapply it is in working in the way i want. Kindly help me Ramya -- View this message in context: http://www.nabble.com/LIST-HELP-tp19905212p19905212.html Sent from the R help mailing list archive at Nabble.com.
could you make this reporducible- even with dummy data...? I am not sure what you want. On Thu, Oct 9, 2008 at 3:01 PM, Rajasekaramya <ramya.victory@gmail.com>wrote:> > Hi, > > I have a list(A1) of dataframe and a vector containing a 22 list names. > list(A1) > abc > l m n > p q r > > dce > e g h > l k m > > kpo > a d c > also i have a vector of list names. > abc,dce similarly i have 22 elements. > > I wanna delete or want a list without the list elements whoes name match up > the vector. > > my result should be > kpo > a d c. > > i tried lapply it is in working in the way i want. > Kindly help me > Ramya > > > > -- > View this message in context: > http://www.nabble.com/LIST-HELP-tp19905212p19905212.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]]
Dear Ramya, Try this: # Your list A=matrix(rnorm(100),ncol=10) B=matrix(rnorm(100),ncol=10) C=matrix(rnorm(100),ncol=10) colnames(A)=colnames(B)=colnames(C)=paste('X',1:10,sep="") mylist=list(A,B,C) names(mylist)=c('A','B','C') # Your name vector x=c('A','C') # Marching up! mylist[names(mylist) %in% x] HTH, Jorge On Thu, Oct 9, 2008 at 3:01 PM, Rajasekaramya <ramya.victory@gmail.com>wrote:> > Hi, > > I have a list(A1) of dataframe and a vector containing a 22 list names. > list(A1) > abc > l m n > p q r > > dce > e g h > l k m > > kpo > a d c > also i have a vector of list names. > abc,dce similarly i have 22 elements. > > I wanna delete or want a list without the list elements whoes name match up > the vector. > > my result should be > kpo > a d c. > > i tried lapply it is in working in the way i want. > Kindly help me > Ramya > > > > -- > View this message in context: > http://www.nabble.com/LIST-HELP-tp19905212p19905212.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Try this: A1 <- list(abc = letters[1:3], dce = letters[4:6], kpo = letters[7:8]) v <- c("abc", "dce") A1[setdiff(names(A1), v)] On Thu, Oct 9, 2008 at 4:01 PM, Rajasekaramya <ramya.victory at gmail.com> wrote:> > Hi, > > I have a list(A1) of dataframe and a vector containing a 22 list names. > list(A1) > abc > l m n > p q r > > dce > e g h > l k m > > kpo > a d c > also i have a vector of list names. > abc,dce similarly i have 22 elements. > > I wanna delete or want a list without the list elements whoes name match up > the vector. > > my result should be > kpo > a d c. > > i tried lapply it is in working in the way i want. > Kindly help me > Ramya > > > > -- > View this message in context: http://www.nabble.com/LIST-HELP-tp19905212p19905212.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O