Reputation: 305
I have a working solution to this but I'd really like to understand what is causing this issue in the first place. I have a data frame named 'ngx' with a date column named 'DeliveryDate'.
When I try to find the minimum date of a subset of this data frame:
min(ngx[which(ngx$TradedIndexID == 4810), 2])
I run into this error:
Error in FUN(X[[i]], ...) : only defined on a data frame with all numeric variables
But when I tweak the selection of the 'DeliveryDate' column to:
min(ngx[which(ngx$TradedIndexID == 4810), ]$DeliveryDate)
It works just fine:
[1] "2019-08-01"
Does anyone know the underlying issue causing this?
Upvotes: 1
Views: 883
Reputation: 1302
As you mentioned in the comment, your data is of type tibble
. That means you could solve the problem by
data.frame
prior to your calculations: as.data.frame(ngx)
ngx %>% filter(TradedIndexID == 4810) %>% summarise(Min = min(DeliveryDate))
Upvotes: 2