search for: colindx

Displaying 3 results from an estimated 3 matches for "colindx".

Did you mean: colind
2011 Aug 12
1
Details of subassignment (for vectors and data frames)
...e same as indx <- c(1,5,25) for (i in 1:length(indx)) vec[indx[i]] <- c(101,102,103)[i] And in the case of a data frame, df <- data.frame(d1=1:10,d2=11:20,d3=21:30), df[c(1,5,10),c(1,3)] <- data.frame(a=101:103,b=104:106)is functionally the same as rowindx <- c(1,5,10) colindx <- c(1,3) for (i in 1:length(rowindx)) { for (j in 1:length(colindx)) df[rowindx[i],colindx[j]] <- data.frame(a=101:103,b=104:106)[i,j] } Obviously I've verified that these examples work and I realize that my loops also contain subassignments; what I'm really after is to unders...
2010 Sep 07
1
average columns of data frame corresponding to replicates
Hi Group, I have a data frame below. Within this data frame there are samples (columns) that are measured more than once. Samples are indicated by "idx". So "id1" is present in columns 1, 3, and 5. Not every id is repeated. I would like to create a new data frame so that the repeated ids are averaged. For example, in the new data frame, columns 1, 3, and 5 of the original
2012 Nov 07
8
Aggregate data frame across columns
Folks, I have a data frame with columns 200401, 200402, ..., 201207, 201208. These represent years/months. What would be the best way to sum these columns by year? What about by quarter? Thanks for your time, KW -- [[alternative HTML version deleted]]