Re: [R] Using apply function to merge list of data frames

2018-07-27 Thread Jeff Newmiller
; -Original Message- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of >Naresh >> Gurbuxani >> Sent: 25 July 2018 07:17 >> To: R-help@r-project.org >> Subject: [R] Using apply function to merge list of data frames >> >> I ha

Re: [R] Using apply function to merge list of data frames

2018-07-27 Thread S Ellison
xpected results. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Naresh > Gurbuxani > Sent: 25 July 2018 07:17 > To: R-help@r-project.org > Subject: [R] Using apply function to merge list of data frames > > I have

Re: [R] Using apply function to merge list of data frames

2018-07-24 Thread Berend Hasselman
> On 25 Jul 2018, at 08:17, Naresh Gurbuxani > wrote: > > I have a list whose components are data frames. My goal is to construct a > data frame by merging all the list components. Is it possible to achieve > this using apply and without a for loop, as used below? > > Thanks, > Naresh >

Re: [R] Using apply function

2014-01-27 Thread jim holtman
Is this what you want: > random <- expand.grid(R1 = 1:5, R2 = -(1:5)) > result <- cbind(F1 = 10, F2 = 100, random) > > result F1 F2 R1 R2 1 10 100 1 -1 2 10 100 2 -1 3 10 100 3 -1 4 10 100 4 -1 5 10 100 5 -1 6 10 100 1 -2 7 10 100 2 -2 8 10 100 3 -2 9 10 100 4 -2 10 10 100

[R] Using apply function

2014-01-27 Thread Yen Lee
Hi all R-users, I'm trying to using apply function to input a range of values into a function I wrote. I wrote a function with 4 information needed. I would like to make 2 of them fixed and the other 2 random (but with specified values). I would like to replicate the function 1 times. I wa

Re: [R] using apply function and storing output

2010-10-15 Thread Gabor Grothendieck
On Fri, Oct 15, 2010 at 6:46 AM, David A. wrote: > > Thanks Dennis, > > I don't think it was a problem of not feeding in a function for rollapply(), > because I was using mean() and my co.var() function in the FUN argument. > The key part seems to be the transformation that zoo() does to the matr

Re: [R] using apply function and storing output

2010-10-15 Thread David A.
atrix, the rollapply() function now works fine. Thanks again David Date: Fri, 15 Oct 2010 03:00:27 -0700 Subject: Re: [R] using apply function and storing output From: djmu...@gmail.com To: dasol...@hotmail.com CC: r-help@r-project.org Hi: You need to give a function for rollapply() to

Re: [R] using apply function and storing output

2010-10-15 Thread Dennis Murphy
eated function... > > > xxx<-rollapply(ord_raw_filt.df,3,FUN=co.var,by=3) > Error in UseMethod("rollapply") : > no applicable method for 'rollapply' applied to an object of class > "c('matrix', 'integer', 'numeric')

Re: [R] using apply function and storing output

2010-10-15 Thread David A.
ed function... > xxx<-rollapply(ord_raw_filt.df,3,FUN=co.var,by=3) Error in UseMethod("rollapply") : no applicable method for 'rollapply' applied to an object of class "c('matrix', 'integer', 'numeric')" Can you help me with the error?

Re: [R] using apply function and storing output

2010-10-15 Thread Dimitris Rizopoulos
one efficient way to do this, avoiding loops, is using the rowsum() function, e.g., mat <- matrix(rnorm(1710*244), 1710, 244) id <- rep(seq_len(570), each = 3) means <- rowsum(mat, id, FALSE) / 3 Regarding the second part of your question, indeed a "gold" rule of efficient R programming when

Re: [R] using apply function and storing output

2010-10-15 Thread Dennis Murphy
Hi: Look into the rollmean() function in package zoo. HTH, Dennis On Fri, Oct 15, 2010 at 12:34 AM, David A. wrote: > > Hi list, > > I have a 1710x244 matrix of numerical values and I would like to calculate > the mean of every group of three consecutive values per column to obtain a > new mat

[R] using apply function and storing output

2010-10-15 Thread David A.
Hi list, I have a 1710x244 matrix of numerical values and I would like to calculate the mean of every group of three consecutive values per column to obtain a new matrix of 570x244. I could get it done using a for loop but how can I do that using apply functions? In addition to this, do I hav

Re: [R] Using apply function on duplicates in a data.frame

2010-01-31 Thread Sunny Srivastava
Thanks a lot. All the three approaches work for me! On Sun, Jan 31, 2010 at 10:43 PM, hadley wickham wrote: > On Sun, Jan 31, 2010 at 5:05 PM, Sunny Srivastava > wrote: > > Dear R-Helpers, > > I have a data.frame (df) and the head of data.frame looks like > > > > ProbeUID ControlType Pr

Re: [R] Using apply function on duplicates in a data.frame

2010-01-31 Thread hadley wickham
On Sun, Jan 31, 2010 at 5:05 PM, Sunny Srivastava wrote: > Dear R-Helpers, > I have a data.frame (df) and the head of data.frame looks like > >     ProbeUID ControlType     ProbeName GeneName SystematicName > 1665     1577           0 pSysX_50_22_1 pSysX_50       pSysX_50 > 5422     5147          

Re: [R] Using apply function on duplicates in a data.frame

2010-01-31 Thread David Winsemius
On Jan 31, 2010, at 6:05 PM, Sunny Srivastava wrote: Dear R-Helpers, I have a data.frame (df) and the head of data.frame looks like ProbeUID ControlType ProbeName GeneName SystematicName 1665 1577 0 pSysX_50_22_1 pSysX_50 pSysX_50 5422 5147 0 pSysX_49

[R] Using apply function on duplicates in a data.frame

2010-01-31 Thread Sunny Srivastava
Dear R-Helpers, I have a data.frame (df) and the head of data.frame looks like ProbeUID ControlType ProbeName GeneName SystematicName 1665 1577 0 pSysX_50_22_1 pSysX_50 pSysX_50 5422 5147 0 pSysX_49_8_1 pSysX_49 pSysX_49 4042 3843 0 p