similar to: Acumulate assign on lapply list

Displaying 20 results from an estimated 7000 matches similar to: "Acumulate assign on lapply list"

2009 Dec 02
2
lapply assign to list
Hi R users: I got an error that "l1" is not found. This is a sample code: f1<-function(i,l1){ print(l1[[i]]) l1[[i+1]]<<-i return(i) } z1<-list(x=100,NULL,a=c(1,1)) lapply(1:3,f1,l1=z1) My final goal is to update the value of each list component to use it in the following step. I see that print function founds l1[[1]], but the assign instruction not. Thank you
2010 Mar 26
3
Using lapply with two lists
Hello guys, I have a list L1 of matrix. I have another list L2 with the same number of elements representing the row of the L matrix that I want to delete (L1[[i]][-L2[[i]],]) but I can't do this with lapply as it iterates through L1 (first argument) and not L2. Any idea? ----- Anna Lippel -- View this message in context:
2008 Dec 11
2
is there a way to recursilvely lapply
for a simple example: x <- list() x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5)) x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11)) lapply(x,sum) this fails w/ Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument Just wondering if I have overlooked something obvious. one can also do: lapply(x,lapply,sum) but that assumes that you already know how many levels
2010 Feb 14
1
unexpected results with higher-order functions and lapply
I want to use lapply and a function returning a function in order to build a list of functions. > genr1 <- function(k) {function() {k}} > l1 <- lapply(1:2,genr1) > l1[[1]]() [1] 2 This was unexpected. I had expected the answer to be 1, since that is the value k should be bound to when genr1 is applied to the first element of 1:2. By itself genr1 seems to work fine. >
2007 Nov 19
4
sequence of vectors
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1<- c(1,2,3) x2 <- c(4,5) x3 <- c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6). Many thanks in advance, Bernard
2004 May 20
2
for() to lapply()
Hi dear R-users: I have the following problem: I have a list of data.frames (12 variables and 60000 rows, each) I have to merge from an specific point of the list to the end of the list, I am doing so with a for() loop but it is too inefficient and it exhausts memory. How can I convert this for() loop in a function and then use lapply?
2008 Jul 14
2
Insurance review statistical methods
Hi R users: I will like to know if somebody works on insurance statistics (actuarial problems) and had use TRICAST, and can tell me if with all the R tools it can be build a solution like TRICAST or similar. In a word: Do you think that R has all the statistical tools (I mean modeling tools) to make a job similar to TRICAST? Does TRICAST has modeling tools that are not implemented on R yet?
2012 Aug 01
2
assign vectors to objects
Hi everyone, I try to add many vectors (L1,L2,L3....) to multiple list objects (a.list, b.list....) in a workspace. Somethings like below, but it is not working. Any suggestions will be appreciated. Best, John lf=ls(pattern=".lst")  for (x in listfiles) {     dat=read.delim(x,header=F)     for (i in lf) {     assign(i$add,as.numeric(dat[,3]))   #or i$add=as.numeric(dat[,3]    
2000 Dec 20
1
Partial table.
Hi R users: Thank you very much for you help, you are very kind. I am again asking for your help to make a function that returns the numbers of elements of each category given in another vector. I mean, I have a vector "x" with several elements (most of them more that once) and other vector "y" with the elements that I want to count in the first vector (is not a exhaustive
2002 Nov 29
2
Obtaining the variable names of a glm object
Is names(model1$coef) what you're looking for? -----Original Message----- From: Kenneth Cabrera [mailto:krcabrer at epm.net.co] Sent: 29 November 2002 10:36 Cc: R-help at stat.math.ethz.ch Subject: [R] Obtaining the variable names of a glm object Hi, R users! Suppose I make a model like this:
2000 Dec 14
1
Sort in descending order
Hi R users: I want to know how can I easily sort in descending order a whole data frame by one or several variables. Thank you very much for your help. Kenneth Cabrera krcabrer at perseus.unalmed.edu.co krcabrer at epm.net.co Universidad Nacional de Colombia, Sede Medell?n -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2002 Apr 11
14
Ordinal categorical data with GLM
Hello All: I am trying to replicate the results of an example found in Alan Agresti's "Categorical Data Analysis" on pages 267-269. The example is one of a 2 x 2 cross-classification table of ordinal counts: job satisfaction and income. I am able to get Agresti's results for the independence model (G^2 = 12.03 with df = 9) assuming as he does that the data is nominal, but
2006 May 01
3
Repeat dataframe
Hi R list: How can I "repeat" a data frame n times (with n>1000), and obtain a new data frame where all the n data frames are binded by rows? Thank you for your help Kenneth -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
2002 Jun 05
5
Monte Carlo
Doctor in veterinary medecine I have a degree in veterinary epidemiology I would ask if someone can perform Monte Carlo simulation with R. Thanks in advance. Dr Kane Ismaila i_kane at hotmail.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info",
2001 Jun 07
3
Diag "Hat" matrix
Hi R users: What is the difference between in the computation of the diag of the "hat" matrix in: "lm.influence" and the matrix operations with "solve()" and "t()"? I mean, this is my X matrix x1 x2 x3 x4 x5 [1,] 0.297 0.310 0.290 0.220 0.1560 [2,] 0.360 0.390 0.369 0.297 0.2050 [3,] 0.075 0.058 0.047 0.034 0.0230 [4,] 0.114 0.100
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users: I will like to have a legend with math symbols and also with the value of a variable. But I cannot obtain both at the same time (symbol + value of a variable): Here is a reproducible example: m1<-5 m2<-12 plot(1:5,1:5,type="n") legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2) Thank you for
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users: I will like to have a legend with math symbols and also with the value of a variable. But I cannot obtain both at the same time (symbol + value of a variable): Here is a reproducible example: m1<-5 m2<-12 plot(1:5,1:5,type="n") legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2) Thank you for
2007 Jul 29
2
array writing and their filenames
Hi, I want to save a array (say, array[6,7,8]) write a cvs file. How can I do that??? can I write in one file? if I could not write in one file, i want to use a loop to save in different files (in the matrix[6,7,8], should be 8 csv files), such as the filename structure should be: file ="filename" +str(i) +"." +"csv" Many thanks. Dong [[alternative HTML version
2015 Nov 18
2
[PATCH] virtio_ring: Shadow available ring flags & index
On Mon, Nov 16, 2015 at 7:46 PM, Xie, Huawei <huawei.xie at intel.com> wrote: > On 11/14/2015 7:41 AM, Venkatesh Srinivas wrote: > > On Wed, Nov 11, 2015 at 02:34:33PM +0200, Michael S. Tsirkin wrote: > >> On Tue, Nov 10, 2015 at 04:21:07PM -0800, Venkatesh Srinivas wrote: > >>> Improves cacheline transfer flow of available ring header. > >>> >
2015 Nov 18
2
[PATCH] virtio_ring: Shadow available ring flags & index
On Mon, Nov 16, 2015 at 7:46 PM, Xie, Huawei <huawei.xie at intel.com> wrote: > On 11/14/2015 7:41 AM, Venkatesh Srinivas wrote: > > On Wed, Nov 11, 2015 at 02:34:33PM +0200, Michael S. Tsirkin wrote: > >> On Tue, Nov 10, 2015 at 04:21:07PM -0800, Venkatesh Srinivas wrote: > >>> Improves cacheline transfer flow of available ring header. > >>> >