Re: [R] Replacing rows in a data frame

2011-01-17 Thread Henrique Dallazuanna
Try this: testdat[seq(1,10,3),] <- t(replicate(4, c(1,0,0,0,0,0,0,0,0,0))) On Mon, Jan 17, 2011 at 6:29 PM, Brant Inman wrote: > R-helpers, > > Below is a simple example of some output that I am getting while trying to > work with a data frame in R 2.12.1 for Mac. > > - > > testdat <- data

[R] Replacing rows in a data frame

2011-01-17 Thread Brant Inman
R-helpers, Below is a simple example of some output that I am getting while trying to work with a data frame in R 2.12.1 for Mac. - > testdat <- data.frame(matrix(ncol=10, nrow=10)) > colnames(testdat) <- c('a','b','c','d','e','f','g','h','i','j') > testdat[seq(1,10,3),] <- c(1,0,0,0,0,0,0,0