Re: [R] adding rows

2014-09-25 Thread Bert Gunter
epartment of Anthropology >> Texas A&M University >> College Station, TX 77840-4352 >> >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of Rui Barradas >> Sent: Thursday, September 25, 2

Re: [R] adding rows

2014-09-25 Thread Sven E. Templer
t; Behalf Of Rui Barradas > Sent: Thursday, September 25, 2014 3:34 PM > To: eliza botto; r-help@r-project.org > Subject: Re: [R] adding rows > > Hello, > > Try the following. > > fun <- function(x, r){ > if(r > 0){ > m <- length(x)

Re: [R] adding rows

2014-09-25 Thread David L Carlson
77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rui Barradas Sent: Thursday, September 25, 2014 3:34 PM To: eliza botto; r-help@r-project.org Subject: Re: [R] adding rows Hello, Try the following. fun <-

Re: [R] adding rows

2014-09-25 Thread Rui Barradas
Hello, Try the following. fun <- function(x, r){ if(r > 0){ m <- length(x) %/% r y <- numeric(m) for(i in seq_len(m)){ y[i] <- sum(x[((i - 1)*r + 1):(i*r)]) } y }else{

Re: [R] adding rows

2014-05-10 Thread eliza botto
Thankyou very much arun. Its always nice to hear from you. Eliza > Date: Sat, 10 May 2014 03:55:29 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] adding rows > To: r-help@r-project.org > CC: ruipbarra...@sapo.pt; eliza_bo...@hotmail.com > > > > HI, >

Re: [R] adding rows

2014-05-10 Thread arun
HI, If you want to try other ways: fun1 <- function(mat, rowN) {     dm <- dim(mat)[1]     rowN1 <- rowN - 1     indx <- rep(1:rowN, dm - rowN1) + rep(seq(0, dm - rowN), each = rowN)     indx1 <- (seq_along(indx)-1)%/%rowN+1     as.vector(tapply(indx, list(indx1), FUN = function(i) sum(mat[i, ])

Re: [R] adding rows

2014-05-09 Thread eliza botto
Dear Rui and Murphy, Thanks for your help. Eliza > Date: Fri, 9 May 2014 22:55:27 +0100 > From: ruipbarra...@sapo.pt > To: eliza_bo...@hotmail.com; r-help@r-project.org > Subject: Re: [R] adding rows > > Hello, > > Try the following. > > sapply(1:(30 -

Re: [R] adding rows

2014-05-09 Thread Rui Barradas
Hello, Try the following. sapply(1:(30 - 2), function(i) sum(el[i:(i+2), ])) but with number of rows instead of 30. Hope this helps, Rui Barradas Em 09-05-2014 22:35, eliza botto escreveu: Dear useRs, I have a matrix, say "el" of 30 rows and 10 columns, as el<-matrix(sample(1:300),ncol=10)

Re: [R] adding rows without loops

2013-05-23 Thread Adeel Amin
Even the bigmemory package is causing OOM issues. > > > > -Original Message- > > From: Blaser Nello [mailto:nbla...@ispm.unibe.ch] > > Sent: Thursday, May 23, 2013 12:15 AM > > To: Adeel Amin; r-help@r-project.org > > Subject: RE: [R] adding rows without loo

Re: [R] adding rows without loops

2013-05-23 Thread William Dunlap
ject.org] On > Behalf > Of Adeel - SafeGreenCapital > Sent: Thursday, May 23, 2013 5:54 AM > To: 'Blaser Nello'; r-help@r-project.org > Subject: Re: [R] adding rows without loops > > Thank you Blaser: > > This is the exact solution I came up with but when comp

Re: [R] adding rows without loops

2013-05-23 Thread Rainer Schuermann
t; Even the bigmemory package is causing OOM issues. > > -Original Message- > From: Blaser Nello [mailto:nbla...@ispm.unibe.ch] > Sent: Thursday, May 23, 2013 12:15 AM > To: Adeel Amin; r-help@r-project.org > Subject: RE: [R] adding rows without loops > > Merge sho

Re: [R] adding rows...

2013-05-23 Thread Adeel - SafeGreenCapital
Hi Rainer: Thanks for the reply. Posting the large dataset is a task. There are 8M rows between the two of them and the first discrepancy in the data doesn't happen until at least the 40,000th row on each dataframe. The examples I posted are a pretty good abstraction of the root of the issue.

Re: [R] adding rows without loops

2013-05-23 Thread Adeel - SafeGreenCapital
rs to compute. Even the bigmemory package is causing OOM issues. -Original Message- From: Blaser Nello [mailto:nbla...@ispm.unibe.ch] Sent: Thursday, May 23, 2013 12:15 AM To: Adeel Amin; r-help@r-project.org Subject: RE: [R] adding rows without loops Merge should do the trick. How to best u

Re: [R] adding rows without loops

2013-05-23 Thread Blaser Nello
Merge should do the trick. How to best use it will depend on what you want to do with the data after. The following is an example of what you could do. This will perform best, if the rows are missing at random and do not cluster. DF1 <- data.frame(X.DATE=rep(01052007, 7), X.TIME=c(2:5,7:9)*100, V

Re: [R] Adding rows to a table with a loop

2011-10-26 Thread MJS
Thanks for the response, and the advice, glmulti looks like it could be quite a good alternative. As for the adding to the results table problem from within the loop, this webpage:

Re: [R] Adding rows to a table with a loop

2011-10-24 Thread Weidong Gu
It surely can be done. One way is to keep track of selected variables in a set. If a new variable is selected, you expand the selected set and set the frequency to be one, otherwise just increase the freqency of the selected variable (if... else). Also, you might want to have a look at glmulti pac

Re: [R] Adding rows based on column value

2011-07-15 Thread Bansal, Vikas
d. Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: Dennis Murphy [djmu...@gmail.com] Sent: Friday, July 15, 2011 7:38 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] Adding rows based on column val

Re: [R] Adding rows based on column value

2011-07-15 Thread Bansal, Vikas
e function is showing this error.I am confused. Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: Dennis Murphy [djmu...@gmail.com] Sent: Friday, July 15, 2011 7:38 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] Adding ro

Re: [R] Adding rows based on column value

2011-07-15 Thread Dennis Murphy
Hi: This seems to work: library(plyr) # select the variables to summarize: vars <- paste('Case', c('A', 'C', 'G', 'T'), sep = '') # Alternatively, # vars <- names(df)[grep('Case', names(df))] # One way: the ddply() function in package plyr in # conjunction with the colwise() function > ddply(d

Re: [R] Adding rows based on column value

2011-07-14 Thread Bert Gunter
arm Regards > Vikas Bansal > Msc Bioinformatics > Kings College London > > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf > Of Ben Bolker [bbol...@gmail.com] > Sent: Thursday, July 14, 2011 6:24 PM > To: r-h...@stat.

Re: [R] Adding rows based on column value

2011-07-14 Thread Ben Bolker
> From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf > Of Ben Bolker [bbol...@gmail.com] > Sent: Thursday, July 14, 2011 6:24 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] Adding rows based on column value > > Bansal, Vikas kcl.ac

Re: [R] Adding rows based on column value

2011-07-14 Thread Bansal, Vikas
ege London From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Ben Bolker [bbol...@gmail.com] Sent: Thursday, July 14, 2011 6:24 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] Adding rows based on column value Bansal, Vikas kcl.ac.uk> writes: >

Re: [R] Adding rows based on column value

2011-07-14 Thread Ben Bolker
Bansal, Vikas kcl.ac.uk> writes: > I am using this- > > aggregate(x = file[,3:6], by = list(file[,2]), FUN = "sum") > Better, although still not reproducible (please *do* read the posting guide -- it is listed at the bottom of every R list post and is the *first* google hit for "posting guid

Re: [R] Adding rows based on column value

2011-07-14 Thread Bansal, Vikas
Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: Bansal, Vikas Sent: Thursday, July 14, 2011 6:07 PM To: Bert Gunter Subject: RE: [R] Adding rows based on column value Yes sir.I am trying. I am using this- aggregate

Re: [R] Adding rows based on column value

2011-07-14 Thread Bansal, Vikas
, 2011 4:54 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] Adding rows based on column value ?tapply (in base R) ?aggregate ?by (wrapper for tapply) ?ave (in base R -- based on tapply) Also package plyr (and several others, undoubtedly). Also google on "R summarize data by g

Re: [R] Adding rows based on column value

2011-07-14 Thread Bert Gunter
?tapply (in base R) ?aggregate ?by (wrapper for tapply) ?ave (in base R -- based on tapply) Also package plyr (and several others, undoubtedly). Also google on "R summarize data by groups" or similar gets many relevant hits. -- Bert 2011/7/14 Bansal, Vikas : > Dear all, > > I have one prob

Re: [R] Adding rows to column

2010-10-21 Thread 1Rnwb
If I understand correctly you want to create a new dataframe with selected columns which can be achieved this was as well, it will right away create a new dataframe with column headers df2<-df1[ ,c(3,7,9,11,13,15)] -- View this message in context: http://r.789695.n4.nabble.com/Adding-rows-to-c

Re: [R] Adding rows to column

2010-10-21 Thread 1Rnwb
sorry i got clik happy df2<-df1[, c(3,5,7,9,11,13,15)] df2<-df2[grep('ID', df2$Group), ] -- View this message in context: http://r.789695.n4.nabble.com/Adding-rows-to-column-tp3005607p3006302.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Adding rows to column

2010-10-21 Thread Ivan Calandra
Hi! Would df<- table2[grep("ID",table2[,1]), c(7,9,11,13,15)] do what you expect? Ivan Le 10/21/2010 15:42, amb1networks a écrit : I'm new to R. I'm extracting important columns from single table using following code: File2<-"file.txt" table2<- read.delim(File2, skip=19, sep=";", header=

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread Ferry
gt; newrows[,"myID"] <- "+" > rbind ( DF2, newrows) > > > > > > - Original message - > From: "Gabor Grothendieck" <[EMAIL PROTECTED]> > To: "Ferry" <[EMAIL PROTECTED]> > Cc: r-help@r-project.org > D

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread rmailbox
Grothendieck" <[EMAIL PROTECTED]> To: "Ferry" <[EMAIL PROTECTED]> Cc: r-help@r-project.org Date: Fri, 5 Dec 2008 17:50:42 -0500 Subject: Re: [R] adding rows as arithmatic calculation on original rows Here is a solution using sqldf library(sqldf) DF2 <- structur

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread Gabor Grothendieck
Here is a solution using sqldf library(sqldf) DF2 <- structure(list(myID = structure(1:4, .Label = c("a", "b", "c", "d"), class = "factor"), myType = structure(c(2L, 2L, 1L, 1L), .Label = c("Double", "Single"), class = "factor"), myNum1 = c(10, 15, 22, 4), myNum2 = c(11, 25, 33, 6), myNum3 = c(

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread Ferry
Thanks much Jim. On Fri, Dec 5, 2008 at 2:05 PM, jim holtman <[EMAIL PROTECTED]> wrote: > This should get you close: > > > x <- read.table(textConnection("myID myType myNum1 myNum2 myNum3 > + a Single 10 11 12 > + b Single 15 25 35 > +

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread jim holtman
This should get you close: > x <- read.table(textConnection("myID myType myNum1 myNum2 myNum3 + a Single 10 11 12 + b Single 15 25 35 + c Double 22 33 44 + d Double4 6 8"