search for: tfdata_quarter

Displaying 2 results from an estimated 2 matches for "tfdata_quarter".

2008 Jun 05
7
Improving data processing efficiency
...terssinceissue = function(tfdata, quarters_since_issue=40) { result = matrix(nrow=0, ncol=ncol(tfdata)) # rbind for matrix is cheaper, so typecast the result to matrix colnames = names(tfdata) quarterends = sort(unique(tfdata$DATE)) for (aquarter in quarterends) { tfdata_quarter = tfdata[tfdata$DATE == aquarter, ] tfdata_quarter_fitting_nonissuers = tfdata_quarter[ (tfdata_quarter$Quarters.Since.Latest.Issue > quarters_since_issue) & (tfdata_quarter$IPO.Flag == 0), ] tfdata_quarter_ipoissuers = tfdata_quarter[ tfdata_quarter$IPO.Flag == 1, ]...
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame. For instance > ddTable <- data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) I want a dataset that is Id Name 1 Paul 2 Bob > unique(ddTable) Will give me all 4 rows, and > unique(ddTable$Id) Will give me c(1,2), but not accompanied by the name column.