search for: sublist

Displaying 20 results from an estimated 86 matches for "sublist".

2008 Jul 01
1
extracting elements from a list in vectorized form
Hi; It seems to me that has probably been asked in the past. But I cannot find the track. I usually need to extract elements from a list and contruct vector from them; e.g., to create a table. Perhaps there is a way to directly extract them without looping? Simple example: > S.lst $sublist.1 $sublist.1$age [1] 24.58719 $sublist.1$weight [1] 60.82861 $sublist.2 $sublist.2$age [1] 32.39551 $sublist.2$weight [1] 59.46347 etc. I would like to extract, e.g., directly all weights element from each sublist without looping. I know it is possible to do this as: unlist(S.lst)[paste(&q...
2010 Sep 22
2
efficient list indexing
...elp with lists inside lists (a good way to emulate a struct)\ Assume that there is a small list called fred: fred <- list(happy = 1:10, name = "squash") and a big list called bigfred that includes fred list 5 times bigfred <- rep(fred,5) Is it possible somehow to index all these sublists(fred) inside bigfred with a more direct way like this: bigfred[1] shows the first sublist fred bigfred[2][2] shows the second sublist fred, the second element of the fred list So far I found some way to do this by refering to the sublists by the following: bigfred[1+index*length(fred)] where ind...
2013 Oct 26
1
Compare two lists, with their sublists that have same structure
Dear all, I would like to ask your help concering two R lists. If I did everything should have the same structure (that means the same number of sublists, and their sublists also the same number of sublists). What would change between the two lists is the contents of each element in the lists. Could you please help me understand how I can do that in R? I would like to thank you in advance for your help Regards Alex [[alternative HTML version de...
2011 Aug 04
2
How to extract sublist from a list?
Hi everyone, Suppose I have a list named "lst", see below: > lst $sub1 ... $sub1$x ... $sub1$y .... $sub2 ... $sub2$x ... $sub2$y ? $sub3 ... ... ... Now, I want to extract the sub-sublist $y from every sublist(sub1, sub2...) and then storage them to a new list. I know how to extract them by subscript or list name one by one, but I wonder if there exist some tricks to finish this job more automatically. Best regards, Richard @Sydney -- View this message in context: http://r.7896...
2007 Feb 22
3
List filtration
...uot;IPI00807887.1" [[3]] [1] "IPI00807764.1" [[4]] [1] "Somethingelse" What I need to achieve is a filtered list "list2" like so: >list2 [[1]] [1] "IPI00776145.1" [[2]] [1] "IPI00807764.1" [[3]] [1] "IPI00807764.1" So: - if sublist-entry 1 start with "^IPI" make it the list-entry. - otherwise chose the first "^IPI" sublist-entry present. - delete the list-entry if not "^IPI" sublist-entry present. Can anybody nudge me towards an elegant solution without looping - I have LOTS of entries to proces...
2012 Dec 22
1
plotting and saving diagrams automatically
...or easy understanding]Dear useRs, i was wondering that if its possible in R to automatically generate plots and get it saved at the desired location? i have data of cancer patients, from about 1000 cities around the world. i have converted that data into a list (called tcp) and that list has 1000 sublists. the sublists are named, according to the city name. the orientation of the sublists are as follow $ Tokyo month 2009 2010 20111 515 356 1212 444 145 1203 478 147 1244 147 236 1245 785 142 1256 478 111 4787 478 856 7858 147 786 4569 147 122 12310 786 123 14711 123 787 25812 110 898 369 $ Nagoya...
2006 May 26
0
Hellp needed with sublist plugin
Is there somebody out there who has built a working thingy with the Sublist plugin? I can''t get it to work. I get this error message: undefined method `stringify_keys!'' for "2005":String RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace E:/Programmeren/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_r...
2008 Nov 04
2
strange list structure question
my problem is more complex than below but I think below can suffice. i have a list and the name of it at the top level is GGG. so, if i do an lapply and operate on lower components in the sublist, then I can do as shown in EXAMPLE 1 and what will come back will be named GGG at the top level. but, suppose that , the function inside the lapply function was more complex and i wanted to actually use "GGG" in the function but also return it at the top level. I can't figure a w...
2012 Mar 14
2
Apply a loop containing a function on a list
Hi all, I want to do this: B.list$aa= (a loop containing My.fun acting on the reults of second function on a A.list$aa)) or, overally B.list$aa = function (A.list$aa) B.list and A.list has many sublists aa, ab and.... Is there a way I can apply the function and loop on all sublists of A.list and get B.list? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/Apply-a-loop-containing-a-function-on-a-list-tp4471188p4471188.html Sent from the R help mailing list archi...
2011 Oct 14
3
Split a list
I have a list of dataframes i.e. each list element is a dataframe with three columns and differing number of rows. The third column takes on only two values. I wish to split the list into two sublists based on the value of the third column of the list element.  Second issue with lists as well. I would like to reduce each of the sublist based on the range of the second column, i.e. if the range of the second column is greater than twenty for example keep the list element. Could someone help me...
2009 Mar 15
4
primitives again
Dear R Gurus: How do I find the functions which are primitives, please? Thanks, Edna Bell
2012 Jun 11
1
saving sublist lda object with save.image()
Greetings R experts, I'm having some difficulty recovering lda objects that I've saved within sublists using the save.image() function. I am running a script that exports a variety of different information as a list, included within that list is an lda object. I then take that list and create a list of that with all the different replications I've run. Unfortunately I've been having difficu...
2006 Jul 02
4
:order in partial
...n for ordering a partial with an :order clause. say i was iterating over categories and thier corresponding sub-categories (regular belongs to) and wanted to order the subcategories according to a certain column; <% for category in @categories %> <% render: partial => ''sublist'', :collection => category.subcategories, :order => ''position'' %> # position is a column in my subcategories table <% end %> this isn''t really working; is there a different way to do this in the view or do i have to access this through my...
2011 Nov 16
3
access sublists by a variable
Dear list, I'd like to access the elements of a list within another list with the help of a variable. dict <- list( "24" = c(1,2,3,6,12,24,48,72,96,120,144,168,720), "168" = c(1,12,24,48,72,96,120,144,168,336,504,672), "8760" = c(1,24,168,730,4380,8760) ) dict$"24" works fine, but a <- "24" dict$a returns
2012 Feb 13
2
best subset selection on random effects model
Hi, I know leaps() computes the best subset selection for linear model, and the bestglm() computes the best subset selection for generalized linear model. Is there any package for best subset selection on random effects model, or mixed effects model? Thank you so much. Tao [[alternative HTML version deleted]]
2008 May 14
4
Accessing items in a list of lists
...s, "comb": data1 <- list(a = 1, b = 2, c = 3) data2 <- list(a = 4, b = 5, c = 6) data3 <- list(a = 3, b = 6, c = 9) comb <- list(data1 = data1, data2 = data2, data3 = data3) So that all names for the lowest level list are common. How can I most efficiently access all of the sublist items "a" indexed by the outer list names? For example, I can loop through comb[[i]], unlisting as I go, and then look up the field "a", as below, but there has got to be a cleaner way. finaldata <- double(0) for(i in 1:length(names(comb))) { test <- unlist(comb[[i]])...
2005 Dec 30
1
metaprogramming in controller: accessing instance variables
Hi all, I''m trying to move a bunch of methods out of a controller into a library that I can include and call a class method to have it dynamically add a bunch of methods to the controller. The goal is to just add to each controller: include UIEnhancements::SubList sub_list ''Note'', ''incomplete'' and have the sub_list method create all the methods needed to support the sub_list ui.. Where I am running into trouble is that I want the meta-programmed functions to have access to the instance vars (ie: @somethingorother o...
2006 Oct 30
2
which duplicated rows to delete
Hi Say I've this vector with several duplicates >x<-c(1,2,3,4,2,6,2,8,2,3) >which(duplicated(x)) [1] 5 7 9 10 11 But what I realy want is somthing like: List({2,5,7}, {3,10}, ...) Then from each sublist I can specify which of the duplicate items to drop res<-NULL for(vec in myDuplicateList) res<-rbind(res, subset(data[vec,], myCrit)) I'll get some of the way by sorting my original data appropriately, as it's the second and following rows that are 'marked' as duplicates, b...
2013 Jan 07
2
list of lists to matrix
...of 16 and each of of that is further subdivided into variable number of lists. So, i have a kind of list into lists phenomenon. [[1]]$'1' 1 2 3 4 5 6 7 8 9 [[1]]$'2' 1 2 3 4 5 6 7 8 9 i want to convert both these sublists into one column and then cbind it in the following way col1 col2 1 1 2 2 3 3.. 9 9 i want to the same operations on all the 16 lists. thanks in advance, elisa -------------- next part -------------- An embedded and charset-unspecified text w...
2016 Aug 17
5
code to sort otherwise-unsortable "ilist"s, e.g. symbol tables
...iterator insertion_point{begin()}; while ( ! comp(*just_after_last_sorted, *insertion_point) ) ++insertion_point; // set up some needed iterators const iterator just_after_insertion_point{std::next(insertion_point)}; iterator prev_elem_checked_for_order_in_sublist_to_splice{ just_after_last_sorted}; iterator just_after_last_elem_in_sublist_to_splice{std::next(just_after_last_sorted)}; // try to make {the sublist to be spliced} as long as it can be while still being correct while ( (end() != just_after_last_elem_in_sublist_to_spl...