Learn R Programming

poliscidata (version 2.3.0)

plotmeansC: Plots mean comparison

Description

Plots the mean values of a dependent variable at different values of nominal or ordinal independent variable. Makes use of survey package's svy

Usage

plotmeansC(data, function1 = NULL, function2 = NULL, function3, w = 1, ...)

Arguments

data

A dataset (e.g. gss, nes, states, or world) or design dataset (e.g. gssD, nesD, statesD, or worldD)

function1

A function in the form of ~ depvar

function2

A formula in the form of ~ indepvar

function3

A formula in the form of depvar ~ indepvar

w

Weights, in the form ~ weightvar (optional, not needed if you use a design dataset)

...

Additonal arguments passed to gplots package's plotmeans function

Value

No return

Examples

Run this code
# NOT RUN {
   library(poliscidata)
   
   plotmeansC(nesD, ~ft_hclinton, ~pid_x, ft_hclinton~pid_x, 
   xlab="Party Identification", ylab="Ratings of Hillary Clinton", 
   main="Ratings of Hillary Clinton by Party Identification")
   
   plotmeansC(nes,~envir,~pid_3,envir~pid_3,w=~wt,
   xlab="Party Identification",
   ylab="Percent Pro-Environment",
   main="Percentage Favoring Environment over Jobs,\n by Party ID")
   
# }

Run the code above in your browser using DataLab