Displaying 20 results from an estimated 26 matches for "my_list".
Did you mean:
mn_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
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)) {
for (k in c(1:2)) {
if (my_list$earth[i,j,k] == 0) {...
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 loop...
2013 Aug 14
1
local variable assignment: first copies from higher frame?
...iced this when assigning variables to entries within a
'list' structure, like so:
tempf <- function(x, local = TRUE)
{
executing_environment <- environment()
closure_environment <- parent.env(executing_environment)
print(executing_environment)
cat(str(mget("my_list", envir = executing_environment, inherits =
FALSE, ifnotfound = NA)[[1]]))
print(closure_environment)
cat(str(mget("my_list", envir = closure_environment, inherits =
FALSE, ifnotfound = NA)[[1]]))
if(local) {
my_list$x <- x
} else {
my_list$x <<-...
2008 Jan 08
1
storing matrices in a list or vector and preserve dimensions
...ject inside a list() or vector() structure?
thanks in advance,
Bram Kuijper
PS: this is what I do:
# two matrices, which are my objects to be put in the list
my_matrix_object1 <- matrix(data=rep(1,times=9),nrow=3,ncol=3);
my_matrix_object2 <- matrix(data=rep(0,times=9),nrow=3,ncol=3);
my_list <- list()
# note that I explicitly want to append the object to the list
# instead of directly inserting it from the beginning
# (e.g., code to be used in a for-loop)
my_list <- append(my_list,as.matrix(my_matrix_object1));
my_list <- append(my_list,as.matrix(my_matrix_object2));
However,...
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, "//table[@cellpadding = '3']")...
2013 Nov 26
1
dynamic lists at C level
...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 = PROTECT(allocVector(VECSXP, 1));
SEXP result = SET_VECTOR_ELT(my_list, 0, allocVector(INTSXP, 5));
p_result = INTEGER(result);
The number "1" (the length of "my_list") is dynamic, however.
Is there a web reference where I could do some further reading on this topic?
Thank y...
2018 Sep 04
3
Lectura Archivo JSON
Hola comunidad eRrera,
Acudo a ustedes después de pelearme un rato y salir perdedor con la lectura
de un archivo json. Por el momento he conseguido leerlo y transformar la
parte que me interesa a data frame, sin embargo no consigo poder manipular
los datos para calcular por ejemplo la media de una de las variables.
El código que estoy ejecutando es:
library(jsonlite)
json_data <-
2006 Apr 07
3
RJS removing content of div, but not div itself
...ead>
<body>
<h3>Ingredient list</h3>
<p> Enter the name and amount for each ingredient</p>
<div class = "Entryline">
<%= render(:partial => ''entry_form'') %>
</div>
<div id=''my_list''>
</div>
</body>
</html>
------------------ _entry_form.rhtml -------------------
<%= form_remote_tag(:update => ''my_list'',
:url => {:action => :add_item},
:position => ''bottom'')...
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 "top" to "after", the <ul> to <table>, <li> to <tr>...
2011 Jul 17
1
function design: multiple imput names
..., 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 suggestion.
how can give to each element of the list the name of the single variables I
used as imput of "my_fun"??
I hope I was clear in what I want to do
[[alternative HTML version deleted]]
2005 Dec 20
0
Dynamic fields creation and accessing data
...text_field ''invoiceitem'', ''item_qty'', ''index'' =>
invoiceitem_counter
%>
Where are we initialising the counter? Please tell how is the first line
working .
In the rhtml file I have added :
<%= form_remote_tag(:update => "my_list",
:url => { :action => :add_new_item },
:position => "bottom" ) %>
<%= submit_tag "Add New Item" %>
<%= end_form_tag %>
<form action="/ajax/save_items" method="pos...
2005 Dec 23
0
adding items to a particular invoice on the same page
...de with this mail.
View Index.rhtml
<html>
<head>
<title>Ajax List Demo</title>
<%= javascript_include_tag "prototype" %>
</head>
<body>
<h3>Add to list using Ajax</h3>
<%= form_remote_tag(:update => "my_list",
:url => { :action => :add_new_item },
:position => "bottom" ) %>
New item text:
<%= submit_tag "Add" %>
<%= end_form_tag %>
<form action="/ajax/save_items" method=&...
2009 Jun 28
1
applying a function to a pair of components for each row of a list
Hi,
I have a set of (x,y) coordinate pairs that are stored as a list
> my_list
$x
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25
$y
[1] -8.0866819 -7.3876052 -6.6849311 -5.9837693 -5.2967432 -4.6525466
[7] -4.0999453 -3.6556190 -3.3076102 -3.0360780 -2.8220465 -2.6532085
[13] -2.5192816 -2.4086241 -2.3072977 -2.1969611 -2.0574250 -1.8737694...
2006 Jun 21
2
Using RJS to highlight one LI if using insert_html on an UL?
It seems common to use RJS for quickly adding and highlighting a list
that is having content added to it like this:
http://rafb.net/paste/results/Z3m32g48.html
... where "my_list" would be an UL and the partial would insert a LI.
Given that example, is there an easy way to highlight only the newly
inserted LI instead of the whole UL? The only way I can see to do it is
to give each LI a unique identifier in the partial, constructed maybe
from the db id of the record...
2008 Feb 21
7
looping through a list
what is the proper way to loop through a list in a rails view (assuming
that you need to check if it is empty or not)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2007 Sep 20
7
Troubles with ListBox and CheckListBox events
Hi all,
Here is an excerpt of code (with the new syntax from upcoming wxRuby 1.9.2) :
evt_checklistbox(my_checklist, :on_checklistbox)
evt_listbox(my_checklist, :on_listbox)
evt_listbox(my_list, :on_listbox)
def on_checklistbox(event)
checklist = event.event_object
# puts "listbox - event : item[#{event.int}] checked : #{event.checked?}"
puts "listbox - event : item[#{event.selection}] checked :
#{checklist.checked?(event.selection)}"
end
def on_list...
2005 Dec 15
12
Adding multiple invoice items to an invoice on the same form
Hi Friends ,
Got a unique requirement .I am designing a invoice printing system
.So right now I have the NEW page for adding the invoice details to the
table .Now I have the requirement of adding Invoice Items In the same
form .I have added multiple text boxes to enter the values of the Items
using
<%= text_field ''invoiceitems[]'', ''item_price''
2009 Oct 24
6
Working with ListCtrl and ListItem
...would be better to subclass Wx::ListItem and add instances
of this class to the List. Something like this (not tested):
class MyListItem < Wx::ListItem
def initialize(data_object, *args)
super(*args)
# here I need to add the column data, but I don''t know how
end
end
my_list.add_item(MyListItem.new(data_object))
But I have no idea how I can fill the columns in my ListItem-Object.
Any ideas how I can do this? I think it should work with
ListItem#set_data and/or ListItem#set_column but I don''t understand
the docs.
Regards,
Timo
2006 Jan 30
3
RMySQL install
...my_xml.h rlshell.h sslopt-longopts.h
errmsg.h m_string.h my_getopt.h my_pthread.h mysql.h raid.h
rltypedefs.h sslopt-vars.h
history.h my_alloc.h my_global.h my_semaphore.h mysql_time.h
readline.h sql_common.h tilde.h
keycache.h my_config.h my_list.h mysql_com.h mysql_version.h
rlmbutil.h sql_state.h typelib.h
keymaps.h my_dbug.h my_net.h mysqld_error.h my_sys.h
rlprivate.h sslopt-case.h xmalloc.h
There is a dial in here somewhere that I think I am turning the wrong
direction - just can't see it. A...