Re: [R] Dividing rows in groups

2016-04-24 Thread jim holtman
This will handle all the columns; it assumes the ones you want to start with are in column 2 through the end: > library(dplyr) > df1 <- read.table(text = "ID A B + 1 1 2 + 1 0 3 + 25 NA + 2 1 3 + 3

Re: [R] Dividing rows in groups

2016-04-24 Thread jim holtman
You can use 'dplyr': > library(dplyr) > df1 <- read.table(text = "ID A B + 1 1 2 + 1 0 3 + 25 NA + 2 1 3 + 3 1 4 + 4 NA NA + 4 0 1 + 4

Re: [R] Dividing rows in groups

2016-04-23 Thread David Winsemius
> On Apr 23, 2016, at 9:46 PM, Saba Sehrish via R-help > wrote: > > Hi > > > I have two data frames as shown below (second one is obtained by aggregating > rows of similar IDs in df1.). They both have similar number of columns but > rows of df2 are lesser than rows

[R] Dividing rows in groups

2016-04-23 Thread Saba Sehrish via R-help
Hi I have two data frames as shown below (second one is obtained by aggregating rows of similar IDs in df1.). They both have similar number of columns but rows of df2 are lesser than rows of df1. df1: ID A B 1 1 2 1 0 3 2