For example, I'd like to get correlation matrix by 'Species' from 'iris' dataset.
below code works.
but what I want to do is like below code, which doesn't work:
group_by(iris, Species) %>% correlate()
I found a solution, but ANY more short, elegant code using
group_by(iris,Species) %>% nest() %>% mutate(cordf = map(data, correlate)) %>% unnest(cordf)
If python::pandas , below is available
reticulate, above is same as below
library(reticulate) pd = import('pandas') df = pd$DataFrame(iris %>% dict) df$groupby('Species')$corr()