Skip to main content

Elements of Programming

  • 663 Accesses

Part of the Springer Series in the Data Sciences book series (SSDS)

Abstract

Data are everywhere we look. They are not necessarily numeric values stored in a spreadsheet but can be embedded in everyday media, imagery, and text. Stock market performance, for example, is rarely communicated to the public in the form of a spreadsheet (perhaps to investors). Rather it is communicated in the form of concise statements.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-030-71352-2_3
  • Chapter length: 19 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   59.99
Price excludes VAT (USA)
  • ISBN: 978-3-030-71352-2
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   59.99
Price excludes VAT (USA)
Hardcover Book
USD   79.99
Price excludes VAT (USA)

Notes

  1. 1.

    An abridged, hands-on version of this chapter is available in the DIY repository. To follow along, download the DIYs repository from Github (https://github.com/DataScienceForPublicPolicy/diys). The R Markdown file for this DIY is diy-ch03-basics.Rmd.

  2. 2.

    Yes, it does happen.

  3. 3.

    And R Wizard.

  4. 4.

    For more complicated tasks, there’s also the sequence function seq, which takes the starting value for the sequence (from), the stopping value for the sequence (to), and the distance between each of the items in the sequence (by).

  5. 5.

    Two rows and three columns.

  6. 6.

    Not necessary but highly helpful.

  7. 7.

    You can do it in one line: data.frame(some_letters = c("a", "A", "b", "B"), some_numbers = 1:3).

  8. 8.

    In longer code examples in later chapters, we condense the code layout.

  9. 9.

    Visit CRAN for a full list https://cran.r-project.org/web/packages/available_packages_by_name.html.

  10. 10.

    The use of these special characters is covered in Chapter 4.

  11. 11.

    There are other formats that are more subject area specific such as NetCDF (nd) for earth science, but to keep the list concise, we focus on the ones listed in the text.

  12. 12.

    For more efficient data import of large datasets, consider the read_csv function in the readr package.

  13. 13.

    Visit https://github.com/DataScienceForPublicPolicy/data-sets.

  14. 14.

    Also called a pound sign or number sign or octothorpe in the olden days before Twitter.

  15. 15.

    There are a many factors that should inform these decisions. Here, we aim to illustrate the basics of loading and extracting insight from scientific data.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jeffrey C. Chen .

Rights and permissions

Reprints and Permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this chapter

Verify currency and authenticity via CrossMark

Cite this chapter

Chen, J.C., Rubin, E.A., Cornwall, G.J. (2021). Elements of Programming. In: Data Science for Public Policy. Springer Series in the Data Sciences. Springer, Cham. https://doi.org/10.1007/978-3-030-71352-2_3

Download citation