Displaying 20 results from an estimated 300 matches similar to: "Using a FOR LOOP to name objects"
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)) {
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
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
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 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
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
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
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
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
[19] -1.6357864
2016 Jan 18
3
Extraccion de datos de una Web
Buenas tardes,
Quiero extraer datos de una web en la que ser relaciona la semana con
la puntuación obtenida por un jugador. Ahora mismo llego a obtener
elnodo en el que se relacionan la semana con la puntuación obtenida,
pero no soy capaz de extraer esa informacion en una tabla de dos
columna (semana, puntuacion) teniendo en cuenta que puede que haya
semanas que no haya puntuado (en el ejemplo,
2012 Apr 26
8
understanding the FUNCTION function
Hello,
I am trying to understand why the FUNCTION used in several codes, won't
create the object after it finishes running the code.
For instance, look at the following:
Number<- function(x) {MyNumberIs<-x}
When I run
Number(5)
Everything goes well, except that if I try to call the object MyNumberIs, I
won't find it.
I understand that this function can assume many parameters,
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
2007 Nov 18
4
Re ad HTML table
You can use htmlTreeParse and xpathApply from the XML library.
something like:
xpathApply( htmlTreeParse("http://blabla", useInt=T), "//td", function(x)
xmlValue(x))
should do it.
Gamma wrote:
>
> anyone care to explain how to read a html table, it's streaming data
> (updated every second) and i am looking for a suitable function.
>
> The imported html
2007 Dec 14
6
Analyzing Publications from Pubmed via XML
I would like to track in which journals articles about a particular disease
are being published. Creating a pubmed search is trivial. The search
provides data but obviously not as an R dataframe. I can get the search to
export the data as an xml feed and the xml package seems to be able to read
it.
xmlTreeParse("
2008 Oct 06
3
Extracting text from html code using the RCurl package.
Dear R-help,
I want to download the text from a web page, however what i end up
with is the html code. Is there some option that i am missing in the
RCurl package? Or is there another way to achieve this? This is the
code i am using:
> library(RCurl)
> my.url <- 'https://stat.ethz.ch/mailman/listinfo/r-help'
> html.file <- getURI(my.url, ssl.verifyhost = FALSE,
2006 Feb 27
21
what hardware shuld I but to manage 100k of connections per day?
I''m doing a fotolog for a company.
It''s expected to manage about 100k of connections per day and about 1500
concurrents connections.
What hardware should I buy to manage those numbers of connections?
I''m planning to use slackware + lighttpd + fastcgi, but perhaps we will
have to reuse some scripts in php, in that case I would use slackware +
apache + mod_php + fastcgi
2016 Jan 19
2
Extraccion de datos de una Web
Muchas gracias a ambos!!!! Las dos soluciones me han funcionado.
Un saludo.
El día 18 de enero de 2016, 18:35, Carlos Ortega
<cof en qualityexcellence.es> escribió:
> Hola,
>
> Pero, si ya casi lo tienes... te quedan un par de pasos y ya está...
>
> Simplemente tienes que transformar "puntos_nodo" a bien un data.frame aunque
> quedará lleno de cosas que no te
2011 Oct 26
1
Webscraping - How to Scrape Out Text Into R As If Copied & Pasted From Webpage?
Greetings,
I am trying to get all of the text from a web page as if I "selected
all" on the page, pasted into a text file, and then read in the text
file with read.csv().
# this is the actual page I'm trying to acquire text from:
web.pg <- readLines("http://www.airweb.org/?page=574")
# then parsed in hopes of an easier structure to work with:
web.pg <-
2009 Oct 24
6
Working with ListCtrl and ListItem
Hi List,
I''m trying to get my ListCtrl to work. Currently I''ve managed to fill
my ListCtrl with items, but I think it''s not the most beautiful way:
class MyList < Wx::ListCtrl
def initialize(parent, *args)
super(parent, :style => Wx::LC_REPORT|LC_HRULES )
create_layout
fill_list
end
def create_layout
self.insert_column(0, "Name")