Skip to content

Add function to generate/evaluate code for variables ending in ranges of numbers #79

@schroeder-matt

Description

@schroeder-matt

One of the few things that's easier to do in SAS than in R is summing across ranges of variables by number. In SAS, sum(of v1-v4) is interpreted as v1 + v2 + v3 + v4 -- but R has nothing similar that I'm aware of. This is unfortunate because so many Census Bureau datasets have this naming scheme, and many times I need to add up several variables at once.

I created the attached function (building on the framework developed by former Research staff Nicole Sullivan), but I store it in multiple repositories. I figured it would be good to have this in councilR so that it lives in only one place and potentially help others.

sumRange.txt

Is this something that would be a good fit for councilR? If so, please feel free to make edits to anything and everything, because I am not an expert in designing functions. I also made this with Census Bureau data in mind, so you may find opportunities to generalize the code for other uses.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions