search for: byapply

Displaying 9 results from an estimated 9 matches for "byapply".

2018 Feb 20
5
Take the maximum of every 12 columns
Dear all, I have monthly data in wide format, I am only providing data (at the bottom of the email) for the first 24 columns but I have 2880 columns in total. I would like to take max of every 12 columns. I have taken the mean of every 12 columns with the following code: byapply <- function(x, by, fun, ...) { # Create index list if (length(by) == 1) { nc <- ncol(x) split.index <- rep(1:ceiling(nc / by), each = by, length.out = nc) } else # 'by' is a vector of groups { nc <- length(by) split.index <- by } index.list <-...
2018 Feb 20
3
Take the maximum of every 12 columns
...irus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Tue, Feb 20, 2018 at 5:10 PM, Ista Zahn <istazahn at gmail.com> wrote: > Hi Milu, > > byapply(df, 12, function(x) apply(x, 1, max)) > > You might also be interested in the matrixStats package. > > Best, > Ista > > On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb <milujisb at gmail.com> wrote: > > Dear all, > > > > I have monthly data in wide format, I...
2018 Feb 20
0
Take the maximum of every 12 columns
Hi Milu, byapply(df, 12, function(x) apply(x, 1, max)) You might also be interested in the matrixStats package. Best, Ista On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb <milujisb at gmail.com> wrote: > Dear all, > > I have monthly data in wide format, I am only providing data (at the bottom > of...
2018 Feb 20
0
Take the maximum of every 12 columns
Thank you for your kind replies. Maybe I was not clear with my question (I apologize) or I did not understand... I would like to take the max for X0...X11 and X12...X24 in my dataset. When I use pmax with the function byapply as in byapply(df, 12, pmax) I get back a list which I cannot convert to a dataframe. Am I missing something? Thanks again! Sincerely, Milu <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail priva di virus. www.av...
2018 Feb 20
0
Take the maximum of every 12 columns
...ail?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> > <#m_6071581590498622123_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > On Tue, Feb 20, 2018 at 5:10 PM, Ista Zahn <istazahn at gmail.com> wrote: > >> Hi Milu, >> >> byapply(df, 12, function(x) apply(x, 1, max)) >> >> You might also be interested in the matrixStats package. >> >> Best, >> Ista >> >> On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb <milujisb at gmail.com> wrote: >> > Dear all, >> > >> &g...
2018 Feb 20
2
Take the maximum of every 12 columns
...format, I am only providing data (at the > bottom > > of the email) for the first 24 columns but I have 2880 columns in total. > > > > I would like to take max of every 12 columns. I have taken the mean of > > every 12 columns with the following code: > > > > byapply <- function(x, by, fun, ...) > > { > > # Create index list > > if (length(by) == 1) > > { > > nc <- ncol(x) > > split.index <- rep(1:ceiling(nc / by), each = by, length.out = nc) > > } else # 'by' is a vector of groups >...
2018 Feb 20
2
Take the maximum of every 12 columns
...ampaign=sig-email&utm_content=webmail> >> <#m_4297398466082743447_m_6071581590498622123_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> >> On Tue, Feb 20, 2018 at 5:10 PM, Ista Zahn <istazahn at gmail.com> wrote: >> >>> Hi Milu, >>> >>> byapply(df, 12, function(x) apply(x, 1, max)) >>> >>> You might also be interested in the matrixStats package. >>> >>> Best, >>> Ista >>> >>> On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb <milujisb at gmail.com> wrote: >>> > Dea...
2018 Feb 20
0
Take the maximum of every 12 columns
...ntent=webmail> >>> <#m_4297398466082743447_m_6071581590498622123_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> >>> On Tue, Feb 20, 2018 at 5:10 PM, Ista Zahn <istazahn at gmail.com> wrote: >>> >>>> Hi Milu, >>>> >>>> byapply(df, 12, function(x) apply(x, 1, max)) >>>> >>>> You might also be interested in the matrixStats package. >>>> >>>> Best, >>>> Ista >>>> >>>> On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb <milujisb at gmail.com> w...
2018 Feb 20
0
Take the maximum of every 12 columns
...t; > I have monthly data in wide format, I am only providing data (at the bottom > of the email) for the first 24 columns but I have 2880 columns in total. > > I would like to take max of every 12 columns. I have taken the mean of > every 12 columns with the following code: > > byapply <- function(x, by, fun, ...) > { > # Create index list > if (length(by) == 1) > { > nc <- ncol(x) > split.index <- rep(1:ceiling(nc / by), each = by, length.out = nc) > } else # 'by' is a vector of groups > { > nc <- length(by) &g...