├── .Rbuildignore ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── data.R └── full_name.R ├── README.Rmd ├── README.md ├── congress116.Rproj ├── data-raw ├── congress116.R └── pkgdev.R ├── data └── congress116.rda ├── man ├── congress116.Rd └── make_full_name.Rd ├── paper.bib └── paper.md /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^congress116\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^data-raw$ 4 | ^working\.R$ 5 | ^\.httr-oauth$ 6 | ^LICENSE\.md$ 7 | ^README\.Rmd$ 8 | ^\.Ruserdata$ 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .httr-oauth 3 | .Ruserdata 4 | working.R 5 | .Rhistory 6 | .RData 7 | working2.R 8 | collect-friends-script.R 9 | finald-data.R 10 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: congress116 2 | Title: Data on Members of the 116th U.S. Congress 3 | Version: 0.0.1 4 | Authors@R: c( 5 | person("Michael W.", "Kearney", , 6 | email = "kearneymw@missouri.edu", role = c("aut", "cre"), 7 | comment = c(ORCID = "0000-0002-0730-4694")), 8 | person("Lingshu", "Hu", , 9 | role = c("ctb"), 10 | comment = c(ORCID = "0000-0003-0304-882X")), 11 | person("Alevia", "Iuliia", , 12 | role = c("ctb"), 13 | comment = c(ORCID = "0000-0001-6270-8985")), 14 | person("Park", "Jihye", , 15 | role = c("ctb")) 16 | ) 17 | Description: This package provides data identifiers–e.g., congressional IDs, 18 | Twitter IDs–and data-importing convenience functions for information about 19 | members of the 116th United States Congress (Representatives and Senators). 20 | Encoding: UTF-8 21 | LazyData: true 22 | RoxygenNote: 7.0.2 23 | License: MIT + file LICENSE 24 | URL: https://github.com/mkearney/congress116 25 | BugReports: https://github.com/mkearney/congress116/issues 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Michael W. Kearney 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Michael W. Kearney 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(make_full_name,character) 4 | S3method(make_full_name,data.frame) 5 | export(make_full_name) 6 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # congress116 0.0.1 2 | 3 | * Added a `NEWS.md` file to track changes to the package. 4 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' IDs for members of the 116th U.S. Congress 2 | #' 3 | #' A dataset containing official and twitter identifiers associated with members 4 | #' of the 116th U.S. Congress 5 | #' 6 | #' @format A data frame with 544 rows and 3 variables: 7 | #' \describe{ 8 | #' \item{bioguide}{official congressional ID} 9 | #' \item{screen_name_official}{twitter handle associated with (via declaration or .gov URL in account profile) the office held by a member of congress} 10 | #' \item{screen_name_personal}{twitter handle associated with the person–independent of the office} 11 | #' } 12 | #' @source \url{https://twitter.com/} 13 | "congress116" 14 | -------------------------------------------------------------------------------- /R/full_name.R: -------------------------------------------------------------------------------- 1 | #' Create vector of full names 2 | #' 3 | #' Converts first_name, middle_name, last_name, suffix into a single, full-name 4 | #' character vector 5 | #' 6 | #' @param x Input should be either a data frame with name information or a 7 | #' character vector of first names and additional character vectors of middle 8 | #' names, last names, and suffix. If a data frame is provided, it should at a 9 | #' minimum contain the variables 'first_name' and 'last_name' but will also 10 | #' used columns named 'middle_name' or 'suffix' if found in the data frame 11 | #' as well. 12 | #' @param ... Additional character vectors only used if x is a vector of first 13 | #' names. 14 | #' @return The output will match the input–so if data frame then out data frame. 15 | #' @export 16 | make_full_name <- function(x, ...) { 17 | UseMethod("make_full_name") 18 | } 19 | 20 | #' @export 21 | make_full_name.data.frame <- function(x, ...) { 22 | stopifnot( 23 | all(c("first_name", "last_name") %in% names(x)) 24 | ) 25 | if ("middle_name" %in% names(x)) { 26 | x$full_name <- paste0(x$first_name, ifelse(!is.na(x$middle_name), paste0(" ", x$middle_name, " "), " ")) 27 | } else { 28 | x$full_name <- paste0(x$first_name, " ") 29 | } 30 | x$full_name <- paste0(x$full_name, x$last_name) 31 | if ("suffix" %in% names(x)) { 32 | x$full_name <- paste0(x$full_name, ifelse(!is.na(x$suffix), paste0(" ", x$suffix), "")) 33 | } 34 | x 35 | } 36 | 37 | #' @export 38 | make_full_name.character <- function(x, ...) { 39 | dots <- list(...) 40 | if (length(..1) == 0) { 41 | return(x) 42 | } 43 | stopifnot( 44 | all(lengths(dots) == length(x)) 45 | ) 46 | if (is.null(names(dots))) { 47 | names(dots) <- c("middle_name", "last_name", "suffix_name")[seq_along(dots)] 48 | } 49 | if (any(names(dots) == "")) { 50 | names(dots)[names(dots) == ""] <- c("middle_name", "last_name", 51 | "suffix_name")[!names(dots) %in% c("middle_name", 52 | "last_name", "suffix_name")][seq_len(sum(names(dots) == ""))] 53 | } 54 | dots$first_name <- x 55 | x <- as.data.frame(dots, stringsAsFactors = FALSE) 56 | make_full_name(x)[["full_name"]] 57 | } 58 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | library(congress116) 15 | options(width = 90) 16 | ``` 17 | 18 | # congress116 19 | 20 | 21 | 22 | 23 | Data on Members of the 116th U.S. Congress 24 | 25 | ## Installation 26 | 27 | You can install the released version of congress116 from [CRAN](https://CRAN.R-project.org) with: 28 | 29 | ``` r 30 | install.packages("congress116") 31 | ``` 32 | 33 | or the development version from Github 34 | 35 | ``` r 36 | remotes::install_github("r-congress/congress116") 37 | ``` 38 | 39 | 40 | ## Data 41 | 42 | Identifiers for members of the 116th U.S. Congress can be found in the `congress116` dataset 43 | 44 | ```{r} 45 | str(congress116) 46 | ``` 47 | 48 | ## Functions 49 | 50 | Convenience functions are included for importing and joining Congressional data 51 | 52 | ``` r 53 | pp_join(congress116) 54 | ``` 55 | 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # congress116 5 | 6 | 7 | 8 | 9 | 10 | Data on Members of the 116th U.S. Congress 11 | 12 | ## Installation 13 | 14 | You can install the released version of congress116 from 15 | [CRAN](https://CRAN.R-project.org) with: 16 | 17 | ``` r 18 | install.packages("congress116") 19 | ``` 20 | 21 | or the development version from Github 22 | 23 | ``` r 24 | remotes::install_github("r-congress/congress116") 25 | ``` 26 | 27 | ## Data 28 | 29 | Identifiers for members of the 116th U.S. Congress can be found in the 30 | `congress116` dataset 31 | 32 | ``` r 33 | str(congress116) 34 | #> Classes 'tbl_df', 'tbl' and 'data.frame': 1041 obs. of 14 variables: 35 | #> $ bioguide : chr "M001200" "F000465" "F000465" "F000467" ... 36 | #> $ full_name : chr "A. Donald McEachin" "A. Drew Ferguson" "A. Drew Ferguson" "Abby Finkenauer" ... 37 | #> $ screen_name : chr "RepMcEachin" "RepDrewFerguson" "DrewFergusonGA" "RepFinkenauer" ... 38 | #> $ user_id : chr "816181091673448448" "806583915012046854" "694984534249594882" "1081256295469068288" ... 39 | #> $ chamber : chr "House" "House" "House" "House" ... 40 | #> $ party : chr "D" "R" "R" "D" ... 41 | #> $ state : chr "VA" "GA" "GA" "IA" ... 42 | #> $ state_full : chr "Virginia" "Georgia" "Georgia" "Iowa" ... 43 | #> $ district : chr "4th" "3rd" "3rd" "1st" ... 44 | #> $ gender : chr "M" "M" "M" "W" ... 45 | #> $ date_of_birth: Date, format: "1961-10-10" "1966-11-15" ... 46 | #> $ personal : logi FALSE FALSE TRUE FALSE FALSE FALSE ... 47 | #> $ official : logi TRUE TRUE FALSE TRUE FALSE TRUE ... 48 | #> $ campaign : logi FALSE FALSE FALSE FALSE TRUE FALSE ... 49 | ``` 50 | 51 | ## Functions 52 | 53 | Convenience functions are included for importing and joining 54 | Congressional data 55 | 56 | ``` r 57 | pp_join(congress116) 58 | ``` 59 | -------------------------------------------------------------------------------- /congress116.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /data-raw/congress116.R: -------------------------------------------------------------------------------- 1 | ## select the goooglesheets spreadsheet 2 | cng <- googlesheets::gs_title("cngtweets") 3 | 4 | ## read the 5 | d <- googlesheets::gs_read(cng, ws = "congress_alldata", 6 | col_types = c(bioguide = "c")) 7 | congress116 <- dplyr::select(d, bioguide, screen_name_official, screen_name_personal) 8 | usethis::use_data(congress116) 9 | -------------------------------------------------------------------------------- /data-raw/pkgdev.R: -------------------------------------------------------------------------------- 1 | ## code to prepare package 2 | 3 | #usethis::create_package("congress116") 4 | #devtools::document() 5 | #usethis::use_mit_license("Michael W. Kearney") 6 | #usethis::use_readme_rmd() 7 | #usethis::use_news_md() 8 | #usethis::use_git_config() 9 | #usethis::use_git() 10 | #usethis::use_github() 11 | -------------------------------------------------------------------------------- /data/congress116.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-congress/congress116/ed02f5b7f0cb9a877f18878b48dd201fea6d5e80/data/congress116.rda -------------------------------------------------------------------------------- /man/congress116.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{congress116} 5 | \alias{congress116} 6 | \title{IDs for members of the 116th U.S. Congress} 7 | \format{A data frame with 544 rows and 3 variables: 8 | \describe{ 9 | \item{bioguide}{official congressional ID} 10 | \item{screen_name_official}{twitter handle associated with (via declaration or .gov URL in account profile) the office held by a member of congress} 11 | \item{screen_name_personal}{twitter handle associated with the person–independent of the office} 12 | }} 13 | \source{ 14 | \url{https://twitter.com/} 15 | } 16 | \usage{ 17 | congress116 18 | } 19 | \description{ 20 | A dataset containing official and twitter identifiers associated with members 21 | of the 116th U.S. Congress 22 | } 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/make_full_name.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/full_name.R 3 | \name{make_full_name} 4 | \alias{make_full_name} 5 | \title{Create vector of full names} 6 | \usage{ 7 | make_full_name(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{Input should be either a data frame with name information or a 11 | character vector of first names and additional character vectors of middle 12 | names, last names, and suffix. If a data frame is provided, it should at a 13 | minimum contain the variables 'first_name' and 'last_name' but will also 14 | used columns named 'middle_name' or 'suffix' if found in the data frame 15 | as well.} 16 | 17 | \item{...}{Additional character vectors only used if x is a vector of first 18 | names.} 19 | } 20 | \value{ 21 | The output will match the input–so if data frame then out data frame. 22 | } 23 | \description{ 24 | Converts first_name, middle_name, last_name, suffix into a single, full-name 25 | character vector 26 | } 27 | -------------------------------------------------------------------------------- /paper.bib: -------------------------------------------------------------------------------- 1 | @article{Pearson:2017, 2 | Adsnote = {Provided by the SAO/NASA Astrophysics Data System}, 3 | Adsurl = {http://adsabs.harvard.edu/abs/2017arXiv170304627P}, 4 | Archiveprefix = {arXiv}, 5 | Author = {{Pearson}, S. and {Price-Whelan}, A.~M. and {Johnston}, K.~V.}, 6 | Eprint = {1703.04627}, 7 | Journal = {ArXiv e-prints}, 8 | Keywords = {Astrophysics - Astrophysics of Galaxies}, 9 | Month = mar, 10 | Title = {{Gaps in Globular Cluster Streams: Pal 5 and the Galactic Bar}}, 11 | Year = 2017 12 | } 13 | 14 | @book{Binney:2008, 15 | Adsnote = {Provided by the SAO/NASA Astrophysics Data System}, 16 | Adsurl = {http://adsabs.harvard.edu/abs/2008gady.book.....B}, 17 | Author = {{Binney}, J. and {Tremaine}, S.}, 18 | Booktitle = {Galactic Dynamics: Second Edition, by James Binney and Scott Tremaine.~ISBN 978-0-691-13026-2 (HB).~Published by Princeton University Press, Princeton, NJ USA, 2008.}, 19 | Publisher = {Princeton University Press}, 20 | Title = {{Galactic Dynamics: Second Edition}}, 21 | Year = 2008 22 | } 23 | 24 | @article{gaia, 25 | author = {{Gaia Collaboration}}, 26 | title = "{The Gaia mission}", 27 | journal = {\aap}, 28 | archivePrefix = "arXiv", 29 | eprint = {1609.04153}, 30 | primaryClass = "astro-ph.IM", 31 | keywords = {space vehicles: instruments, Galaxy: structure, astrometry, parallaxes, proper motions, telescopes}, 32 | year = 2016, 33 | month = nov, 34 | volume = 595, 35 | doi = {10.1051/0004-6361/201629272}, 36 | adsurl = {http://adsabs.harvard.edu/abs/2016A%26A...595A...1G}, 37 | } 38 | 39 | @article{astropy, 40 | author = {{Astropy Collaboration}}, 41 | title = "{Astropy: A community Python package for astronomy}", 42 | journal = {\aap}, 43 | archivePrefix = "arXiv", 44 | eprint = {1307.6212}, 45 | primaryClass = "astro-ph.IM", 46 | keywords = {methods: data analysis, methods: miscellaneous, virtual observatory tools}, 47 | year = 2013, 48 | month = oct, 49 | volume = 558, 50 | doi = {10.1051/0004-6361/201322068}, 51 | adsurl = {http://adsabs.harvard.edu/abs/2013A%26A...558A..33A} 52 | } 53 | -------------------------------------------------------------------------------- /paper.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Gala: A Python package for galactic dynamics' 3 | tags: 4 | - Python 5 | - astronomy 6 | - dynamics 7 | - galactic dynamics 8 | - milky way 9 | authors: 10 | - name: Adrian M. Price-Whelan 11 | orcid: 0000-0003-0872-7098 12 | affiliation: "1, 2" # (Multiple affiliations must be quoted) 13 | - name: Author Without ORCID 14 | affiliation: 2 15 | affiliations: 16 | - name: Lyman Spitzer, Jr. Fellow, Princeton University 17 | index: 1 18 | - name: Institution 2 19 | index: 2 20 | date: 13 August 2017 21 | bibliography: paper.bib 22 | 23 | # Optional fields if submitting to a AAS journal too, see this blog post: 24 | # https://blog.joss.theoj.org/2018/12/a-new-collaboration-with-aas-publishing 25 | aas-doi: 10.3847/xxxxx <- update this with the DOI from AAS once you know it. 26 | aas-journal: Astrophysical Journal <- The name of the AAS journal. 27 | --- 28 | 29 | # Summary 30 | 31 | The forces on stars, galaxies, and dark matter under external gravitational 32 | fields lead to the dynamical evolution of structures in the universe. The orbits 33 | of these bodies are therefore key to understanding the formation, history, and 34 | future state of galaxies. The field of "galactic dynamics," which aims to model 35 | the gravitating components of galaxies to study their structure and evolution, 36 | is now well-established, commonly taught, and frequently used in astronomy. 37 | Aside from toy problems and demonstrations, the majority of problems require 38 | efficient numerical tools, many of which require the same base code (e.g., for 39 | performing numerical orbit integration). 40 | 41 | ``Gala`` is an Astropy-affiliated Python package for galactic dynamics. Python 42 | enables wrapping low-level languages (e.g., C) for speed without losing 43 | flexibility or ease-of-use in the user-interface. The API for ``Gala`` was 44 | designed to provide a class-based and user-friendly interface to fast (C or 45 | Cython-optimized) implementations of common operations such as gravitational 46 | potential and force evaluation, orbit integration, dynamical transformations, 47 | and chaos indicators for nonlinear dynamics. ``Gala`` also relies heavily on and 48 | interfaces well with the implementations of physical units and astronomical 49 | coordinate systems in the ``Astropy`` package [@astropy] (``astropy.units`` and 50 | ``astropy.coordinates``). 51 | 52 | ``Gala`` was designed to be used by both astronomical researchers and by 53 | students in courses on gravitational dynamics or astronomy. It has already been 54 | used in a number of scientific publications [@Pearson:2017] and has also been 55 | used in graduate courses on Galactic dynamics to, e.g., provide interactive 56 | visualizations of textbook material [@Binney:2008]. The combination of speed, 57 | design, and support for Astropy functionality in ``Gala`` will enable exciting 58 | scientific explorations of forthcoming data releases from the *Gaia* mission 59 | [@gaia] by students and experts alike. 60 | 61 | # Mathematics 62 | 63 | Single dollars ($) are required for inline mathematics e.g. $f(x) = e^{\pi/x}$ 64 | 65 | Double dollars make self-standing equations: 66 | 67 | $$\Theta(x) = \left\{\begin{array}{l} 68 | 0\textrm{ if } x < 0\cr 69 | 1\textrm{ else} 70 | \end{array}\right.$$ 71 | 72 | 73 | # Citations 74 | 75 | Citations to entries in paper.bib should be in 76 | [rMarkdown](http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html) 77 | format. 78 | 79 | For a quick reference, the following citation commands can be used: 80 | - `@author:2001` -> "Author et al. (2001)" 81 | - `[@author:2001]` -> "(Author et al., 2001)" 82 | - `[@author1:2001; @author2:2001]` -> "(Author1 et al., 2001; Author2 et al., 2002)" 83 | 84 | # Figures 85 | 86 | Figures can be included like this: ![Example figure.](figure.png) 87 | 88 | # Acknowledgements 89 | 90 | We acknowledge contributions from Brigitta Sipocz, Syrtis Major, and Semyeong 91 | Oh, and support from Kathryn Johnston during the genesis of this project. 92 | 93 | # References 94 | --------------------------------------------------------------------------------