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"

[R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread Ferry
Dear R users, Suppose I have the following data.frame: myID myType myNum1 myNum2 myNum3 a Single 10 11 12 b Single 15 25 35 c Double 22 33 44 d Double4 6 8 and I want t