I have a dataset of chemical properties that I downloaded from here.
I want to filter this dataset. For a given compound, phase, and pressure, I want only the measurements taken above a temperature at which the lowest measurement occurs.
For example, for specific heat capacity, I want something like:
aggregate(
seq(nrow(data)),
list(data$phase, data$compound, data$p),
function(ids) {
subset = data[ids,]
subset[ subset$T > subset$T[ subset$Cp == min(subset$Cp) ] ,]
}
)
However that returns something I can't make sense of. If I had to guess, I'd say it's returning a dataframe in which the cells in one column are populated by vectors that contain the contents of the dataframes I return from the callback function.
Is there any way I can convince aggregate()
to call rbind()
on the data frames returned by the callback? Is there a function I should be using besides aggregate()
?