Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-jr42d Total loading time: 0 Render date: 2024-04-25T02:23:15.187Z Has data issue: false hasContentIssue false

4 - Looking at Data – Tables

from PART I - R AND BASIC STATISTICS

Published online by Cambridge University Press:  22 July 2017

David L. Carlson
Affiliation:
Texas A & M University
Get access

Summary

A table is simply a two-dimensional presentation of data or a summary of the data. We use tables to inspect the original data for errors or problems such as missing entries. We used tables to present condensed summaries of data values in Chapter 3 (e.g., numSummary()). Those summaries involved computing summary statistics by a categorical variable to see how the groups differed from one another. We can also use tables to see how categorical variables covary.

Nominal or categorical data play a large role in archaeological research. At the regional level, sites are the categories and we are interested in the number of different types of artifacts (also a category) found in each site. The same applies at the site level where the artifact categories are distributed across excavation units. Within sites, different kinds of features are present and features contain different types of artifacts. At the artifact level, some properties of artifacts are represented by categories. Because of this, the same data are often represented in different ways for different purposes. That is not a problem unless the statistical procedures we are using expect a format different from the one we are currently using. In Chapter 3, we created tables of descriptive statistics. In this chapter we are concerned with tables in which the cell entries consist of counts of objects.

R distinguishes between tables and data frames and some functions will work with one but not the other. Data frames have columns that represent different types of data (e.g., character strings, factors, numbers), but tables in R represent numeric data only. In fact, R tables are a kind of matrix. Before constructing tables, we will briefly describe how R encodes categorical data using factors.

FACTORS IN R

Factors are a way of storing categorical information in R. If you have coded a variable into a set of categories, you have the choice of storing the information as a character or factor vector. A factor stores each category as an integer and the category labels are stored as levels. If you import your data into a data frame, R will automatically convert character vectors into factors unless you use the argument stringsAsFactors=FALSE.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2017

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×