Access over 20 million homework & study documents

R Analysis Updated

Content type
User Generated
Subject
Computer Science
School
American InterContinental University
Type
Homework
Rating
Showing Page:
1/6
R Analysis
Name
University
August 14, 2021

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/6
2
Problem Description
The Congressional Voting Records dataset includes votes for each of the U.S. House of
Representatives Congressmen on the 16 votes, such as Handicapped Infants and Toddler Act
(handicapped-infants), Cost Sharing for Federal Water Projects (water-project-cost-sharing),
Adoption of the Budget Resolution (adoption-of-the-budget-resolution), etc. There are three
possible vote results: yea, represented as ‘y’, nay, represented as ‘n’ and unknown disposition,
represented as ‘?’. Unknown votes are treated as missing data.
Use Apriori algorithm to find voting preference for both Republican and Democrat.
E.g.: if {budget resolution = no, MX-missile = no, aid to El Salvador = yes}
{Party = Republican}
Questions:
1. Show your R code in a Word file.
Code:
install.packages("arules")
library(arules)
install.packages("arulesViz")
library(arulesViz)
install.packages("igraph")
library(igraph)
install.packages("visNetwork")
library(visNetwork)
install.packages("plyr")
library(plyr)
library(readr)
Congressional_Voting_Records <-
read_csv("C:/Users/ROSE/Desktop/Congressional_Voting_Records.csv")
data<- read_csv("C:/Users/ROSE/Desktop/Congressional_Voting_Records.csv")
result <- apriori(data, parameter = list(sup = 0.35, conf = .8, target="rules") , appearance = list
(default = 'lhs', rhs = c('party=democrat','party=republican')) )
result <- sort(result, decreasing = TRUE, by = "support")
inspect(result[ 1:5] )
plot(result, shading="", control=list(main = "Two-key plot"))
result <- apriori(data, parameter = list(sup = 0.35, conf = .8, target="rules") , appearance = list
(default = 'lhs', rhs = 'party=republican') )
result <- sort(result, decreasing = TRUE, by = "confidence")
inspect(result[1:2])
result <- apriori(data, parameter = list(sup = 0.35, conf = .8, target="rules") , appearance = list

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/6

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
R Analysis Name University August 14, 2021 2 Problem Description The Congressional Voting Records dataset includes votes for each of the U.S. House of Representatives Congressmen on the 16 votes, such as Handicapped Infants and Toddler Act (handicapped-infants), Cost Sharing for Federal Water Projects (water-project-cost-sharing), Adoption of the Budget Resolution (adoption-of-the-budget-resolution), etc. There are three possible vote results: yea, represented as ‘y’, nay, represented as ‘n’ and unknown disposition, represented as ‘?’. Unknown votes are treated as missing data. Use Apriori algorithm to find voting preference for both Republican and Democrat. E.g.: if {budget resolution = no, MX-missile = no, aid to El Salvador = yes} {Party = Republican} Questions: 1. Show your R code in a Word file. Code: install.packages("arules") library(arules) install.packages("arulesViz") library(arulesViz) install.packages("igraph") library(igraph) install.packages("visNetwork") library(visNetwork) install.packages("plyr") library(plyr) library(readr) Congressional_Voting_Records ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Awesome! Perfect study aid.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4