Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
I stumbled over this when I was rolling up sample size (
.N) for different sets of grouping variables, including no grouping.If using
groupingsetswith an unnamed expression injwhich is "autonamed" (e.g..N) and including an "ungrouped" grouping set, then an additional variable is created for the ungrouped set.Some data:
With a "grouped" grouping set only, an unnamed expression with
.Ninjworks: the result is autonamedN:However, when also including an "ungrouped" grouping set (
character()), an additional column is generated for the ungrouped result:With an ungrouped grouping set only, the
Ncolumn is included despite it was only used for the grouped result in the previous example:Similar examples with named expressions in
j, likej = .(N = .N), works.Additional (admittedly contrived) attempts with
.GRPand.Iinjgive similar results. Thus, it seems like this behaviour may be related to autonaming.