In the ANES 2016 codebook, identify one nominal, one ordinal, and one numeric variable.

For the numeric variable, assess the reliability and validity.

- Read more about Group Exercise: Levels of Measurement
- 7 comments
- Log in to post comments

Let's create a variable with a series of data points:

**HHsize<-c(2,3,2,1,4,5,1,1,2,5,1,2,2,6,1,2,2,4)**

We've created a vector to hold these data points. You can imagine, as we discussed, that each data point is in a box, and the vector is a stack of boxes. It doesn't matter if the boxes are stacked vertically or horizontally.

We can refer to a specific box by using the square brackets, [ ]

**HHsize[3]**

This refers to the third data point in the vector, which in this case, has a value of 2.

- Read more about More Basics in R
- Log in to post comments

Use the code:

ANES2016<-read.csv("http://www.shortell.nyc/online/files/anes_timeseries_2016.csv")

If you save your data library (session) in R, you won't have to read in the data again. You need to use attach(ANES2016) to load the variable names in the search string each session, however.

- Read more about Reading the ANES 2016 data
- Log in to post comments

Write R code to create the following:

a) a scalar

b) a vector

c) a matrix

d) a data frame

Paste your R code as a comment to this page.

- Read more about Group Exercise: Data Structures
- 7 comments
- Log in to post comments

Each group will write R code to compute the average of a series of numbers, assign that result to a variable, and then transform that variable with an arithmetic operation (addition, subtraction, multiplication, division). Test your code in R and when it works, copy and paste the code into a comment so we can discuss what you've done.

- Read more about Group Exercise: R Syntax
- 5 comments
- Log in to post comments

Basic Syntax

More Syntax

An Example

- Read more about An Introduction to R
- Log in to post comments

Imagine that we are doing research to investigate gender differences. Identify a variable (from a survey question) that measures the following concept and then construct a 2x2 percentage table (crosstabulation) to demonstrate what result would show a gender difference, or, in other words, a causal relationship between gender and that concept.

- political affiliation
- presidential vote in 2016
- religiosity
- educational attainment
- employment status
- home ownership

- Read more about Group Exercise: Visualizing relationships
- 5 comments
- Log in to post comments

- « first
- ‹ previous
- 1
- 2
- 3
- 4