<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>anpontan382</author_name>
  <author_url>https://blog.hatena.ne.jp/anpontan382/</author_url>
  <blog_title>R筋</blog_title>
  <blog_url>https://anpontan382.hatenablog.com/</blog_url>
  <categories>
    <anon>R</anon>
  </categories>
  <description>部署ごとの社員数を求めるとか 地域ごとの売上1位の店舗を求めるとか、グループ化して集計するという場面は多いので、 メモ。これ(iris)↓から SpeciesごとにSepal.Lengthが最大になる行だけを取り出したい。 つまり↓ とするには、 library(dplyr) iris %&gt;% group_by(Species) %&gt;% filter(Sepal.Length == max(Sepal.Length)) が、手っ取り早し。標準のarrregate関数というものもあるが、対象列（Sepal.Length）のみの集計になってしまう。 aggregate(iris$Sepal.Len…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fanpontan382.hatenablog.com%2Fentry%2F2019%2F02%2F16%2F115407&quot; title=&quot;【R】グループ化して集計するあれこれ - R筋&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/a/anpontan382/20190216/20190216110042.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-02-16 11:54:07</published>
  <title>【R】グループ化して集計するあれこれ</title>
  <type>rich</type>
  <url>https://anpontan382.hatenablog.com/entry/2019/02/16/115407</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
