Re: [R] Add blank rows to a dataframe

2013-06-08 Thread arun
RowSel <-c(0,1,0,1,2,3,0,5,5) set.seed(24) DF<- as.data.frame(matrix(sample(1:40,45,replace=TRUE),ncol=5)) RowSel[!as.logical(RowSel)]<-NA DF[RowSel,] # V1 V2 V3 V4 V5 #NA   NA NA NA NA NA #1    12 11 21 24 30 #NA.1 NA NA NA NA NA #1.1  12 11 21 24 30 #2 9 25  6 26 26 #3    29 15  4  2 28 #

Re: [R] Add blank rows to a dataframe

2013-06-08 Thread David Winsemius
On Jun 8, 2013, at 4:09 AM, Bert Jacobs wrote: > Hi, > > I have a vector that looks like this: > RowSel <-c(0,1,0,1,2,3,0,5,5) > > Now I want to select rows from a specific dataframe DF based on that vector > like this: > SubDF <- DF[RowSel,] > > So this works fine, but I was wondering how I c

Re: [R] Add blank rows to a dataframe

2013-06-08 Thread Duncan Murdoch
On 13-06-08 7:09 AM, Bert Jacobs wrote: Hi, I have a vector that looks like this: RowSel <-c(0,1,0,1,2,3,0,5,5) Now I want to select rows from a specific dataframe DF based on that vector like this: SubDF <- DF[RowSel,] So this works fine, but I was wondering how I could add blank rows add the