similar to: looping through a list

Displaying 20 results from an estimated 1000 matches similar to: "looping through a list"

2009 Sep 05
5
Filling Wx::ListCtrl with contents
Hi all, I''ve got a question concerning ListCtrl_virtual of wxRuby since I see no way filling the list with dynamic contents. I''m new to Ruby so I maybe have to apologise for my request. The problem is, that I have to define the on_get_item_text(item, col) function. There I would like to use the item and col variables to read data from a two-dimensional array. My very problem
2013 Feb 14
3
list of matrices --> array
i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list <- list() my_list[[1]] <- matrix(1:20, ncol = 5) my_list[[2]] <- matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list to a 2x4x5 (or some other permutation of the dim sizes) array. i know i can initialize the array, then
2011 Sep 27
2
Matrix and list indices
Hi guys, I am trying to replace all elements of earth that are equal to zero with their corresponding elements in mars. I can do the replace with a bunch of for-loops, but I don't think this is the R way of doing things. my_list <- list( earth=array(c(0,0,45,0,0,45,0,45),dim=c(2,2,2)), mars=array(c(8:1),dim=c(2,2,2))) my_list for (i in c(1:2)) { for (j in c(1:2)) {
2009 Apr 17
1
Run a single test with Test::Unit?
Hi, I have tests written as: test "some test" do ... end But when I want to run a single test it doesn''t work like before: $ ruby test/functional/some_controller_test.rb -n some_test Iget 0 test, 0 assertions... I also rewrote the test to : def some_test ... end And still no luck. Has anything changed from the various tutorials found on the internet? Also
2006 Oct 11
5
Marshal Data too short error with ActiveRecord sess. storage
I''m seeing a "marshal data too short" error with an ActiveRecord store for my session data. Other posts say that this happens when the size of the session data exceeds the size of the "data" column in the sessions table. But my "data" column is a TEXT field so it seems unlikely that I could have blown it out. Has anyone else seen "marshal data too
2008 Jan 08
1
storing matrices in a list or vector and preserve dimensions
Hi all, As an R newbie, I wonder how I can store multiple matrices in a list() or vector() object without losing their structure. I should be able to retrieve the matrix from the list later on. If I just append() the matrices to a list() object, they automatically lose their dimensions, whereas I would like to preserve the dimensions of the matrices. Is there any function in R which allows
2013 Aug 14
1
local variable assignment: first copies from higher frame?
hi all -- this might not be the correct list for this question/discussion, though R-help didn't seem like the correct venue, either, so... i'm looking for just some extra clarification of how local variables are defined/bound, beyond the simple cases given in the Language document. the particular instance is when there is variable assignment inside a function. normally, this creates a
2012 Feb 29
2
Using a FOR LOOP to name objects
Hello, I am trying to use a for loop to name objects in each iteraction. As in the following example (which doesn't work quite well) my_list<-c("A","B","C","D","E","F") for(i in c(1:length(my_list))){ url<- "http://finance.yahoo.com" doc = htmlTreeParse(url, useInternalNodes = T) tab_nodes = xpathApply(doc,
2010 Feb 02
3
[LLVMdev] jit X86 target compilation callback bug
Hi! We are running llvm jit x86 on MS Visual Studio 2005. It seems there is a bug in asm code in function X86CompilationCallback in file X86JITInfo.cpp. Current code sets stack pointer to invalid value in instruction "and esp, 16". Depending on current stack pointer value it sometimes overwrites ecx and edx registers with next three lines. We have fixed this problem by changing this
2013 Nov 26
1
dynamic lists at C level
Dear R-devel, I am trying to do something similar to dynamic length lists in R, but at C level. In R, that would be rather trivial: - determine the length of the list - create the list object - store the values for each component - access value components by using "[[" At C level, for a single component where I need to store a vector of length 5, I do: int *p_result; SEXP my_list =
2006 Apr 07
3
RJS removing content of div, but not div itself
Hi, I''m creating a list of ingredients on a page. When the user clicks the ''Add Ingredient'' button a record gets added to the db and the ingredient gets added to the page. On the page, each record is represented by a <div> with three <span>s inside. One of the <span>s has a link_to_remote to ''delete'' the ingredient. When the link
2010 Feb 02
0
[LLVMdev] jit X86 target compilation callback bug
Hello > We are running llvm jit x86 on MS Visual Studio 2005. It seems there > is a bug in asm code in function X86CompilationCallback in file > X86JITInfo.cpp. Current code sets stack pointer to invalid value in > instruction "and   esp,  16". Depending on current stack pointer value > it sometimes overwrites ecx and edx registers with next three lines. How so? The stack
2010 Jul 11
1
difficulty with R expressions in text/legend
hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here's a working legend(...) call that is close to what i'd like (where x and y are returned from an lm(...) call): legend("topleft", legend = c(bquote(R^2 == .(summary(x)$r.squared)), bquote(R^2 == .(summary(y)$r.squared))), fill =
2006 Apr 03
3
Ready to call this a bug
I''ve been trying to get a handle on AJAX today and am ready to call "BUG!" I started with the code from Curt''s "AJAX on Rails". It used <ul="my_list"> and <li> and worked fine. Except I need a table instead of a list. So I did the simplest thing that I thought could possibly work. In the view, I changed the :position attribute from
2010 Oct 01
3
scoping goes wrong when some functions are used within others.
Dear, I'm following the r tag on stackoverflow.com, and couldn't but notice there are quite some questions popping up that deal with scoping in relation to custom functions. I grinded my teeth on it already, and I have absolutely no clue what goes wrong. The general pattern is as follows : ff <- function(x){ y <- some_value some_function(y) } > ff(x) Error in eval(expr,
2011 Jul 17
1
function design: multiple imput names
dear all, a simple question, I need to write a function in which I retrive an undetermined number of vector in the function. I solved the problem thanks to this link http://stackoverflow.com/questions/2540232/how-to-allow-multiple-inputs-from-user-using-r so my function will look alike this my_fun <- function(...){ my_list <- lapply(..., function(x){x}) } I need just one more
2008 Jul 25
21
Problems with mock assigned to a constant
Hi all, Initially I thought this was a bug in the built-in mocking framework(and it still may be), but I better hash it out on the mailing list before I file/reopen the ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/478-mocks-on-constants#ticket-478-6 I thought my example illustrated my problem, but obviously I was passing the wrong arguments to the mock. I revised my example to
2013 May 21
1
Calculating AIC for the whole model in VAR
Hello! I am using package "VAR". I've fitted my model: mymodel<-VAR(mydata,myp,type="const") I can extract the Log Liklihood for THE WHOLE MODEL: logLik(mymodel) How could I calculate (other than manually) the corresponding Akaike Information Criterion (AIC)? I tried AIC - but it does not take mymodel: AIC(mymodel) # numeric(0) Thank you! -- Dimitri Liakhovitski
2018 May 18
3
Exporting to text files
I have dose response data analyzed with the package 'drc'. 'summary(mymodel)' prints my kinetic parameters. I want that text in an ASCII text file. I want to get exactly what I would get if I copied and pasted from the terminal window. I've read the documentation on data export to text files here:
2006 Nov 16
2
dynamically adding static (class) methods to a class
Hello again, I guess this is more of a Ruby question, but here goes anyways... I want to intercept all calls to non existent class methods and then call an existing class method with the non existent name. In code... class MyModel < ActiveRecord::Base def MyModel.method_missing(symbol, *args) MyModel.func(symbol.id2name) end def MyModel.func(func_called) puts "You