library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
immigration <- read.csv("immigration.csv")

Research Question

How do political beliefs affect opinions on what should happen to workers who have illegally entered the U.S.?

Introduction

In recent years, immigration policy has become a divisive topic in American politics. This project investigates how registered voters with different political ideologies (conservative, moderate, and liberal) differ in their views on how the U.S. should handle workers who have entered the country illegally.

The dataset used in this project, titled immigration, contains responses from 910 randomly selected registered voters in Tampa, Florida. The participants were asked about their political ideology and their opinion on what should happen to workers who have illegally entered the U.S. The dataset contains two columns:

• response: This variable records each respondent’s opinion with four possible answers — Apply for citizenship, Guest worker, Leave the country, and Not sure.

• political: This variable records each respondent’s political ideology — conservative, moderate, or liberal.

The goal of this analysis is to explore whether political ideology is associated with more supportive or stricter views toward illegal workers.

Data Analysis

To address the research question, we will perform basic data cleaning and exploratory data analysis (EDA). This includes checking for missing values, summarizing counts by political affiliation, and comparing how each group responded to the immigration question. We will use functions such as filter(), mutate(), and summary(), and create a bar plot to visualize how opinions differ across political ideologies.

head(immigration)
##                response    political
## 1 Apply for citizenship conservative
## 2 Apply for citizenship conservative
## 3 Apply for citizenship conservative
## 4 Apply for citizenship conservative
## 5 Apply for citizenship conservative
## 6 Apply for citizenship conservative
summary(immigration)
##    response          political        
##  Length:910         Length:910        
##  Class :character   Class :character  
##  Mode  :character   Mode  :character

Clean Data - Remove Missing or unknown responses

library(dplyr)
clean_data <- immigration %>%
  filter(response != "Not sure")
print(clean_data)
##                  response    political
## 1   Apply for citizenship conservative
## 2   Apply for citizenship conservative
## 3   Apply for citizenship conservative
## 4   Apply for citizenship conservative
## 5   Apply for citizenship conservative
## 6   Apply for citizenship conservative
## 7   Apply for citizenship conservative
## 8   Apply for citizenship conservative
## 9   Apply for citizenship conservative
## 10  Apply for citizenship conservative
## 11  Apply for citizenship conservative
## 12  Apply for citizenship conservative
## 13  Apply for citizenship conservative
## 14  Apply for citizenship conservative
## 15  Apply for citizenship conservative
## 16  Apply for citizenship conservative
## 17  Apply for citizenship conservative
## 18  Apply for citizenship conservative
## 19  Apply for citizenship conservative
## 20  Apply for citizenship conservative
## 21  Apply for citizenship conservative
## 22  Apply for citizenship conservative
## 23  Apply for citizenship conservative
## 24  Apply for citizenship conservative
## 25  Apply for citizenship conservative
## 26  Apply for citizenship conservative
## 27  Apply for citizenship conservative
## 28  Apply for citizenship conservative
## 29  Apply for citizenship conservative
## 30  Apply for citizenship conservative
## 31  Apply for citizenship conservative
## 32  Apply for citizenship conservative
## 33  Apply for citizenship conservative
## 34  Apply for citizenship conservative
## 35  Apply for citizenship conservative
## 36  Apply for citizenship conservative
## 37  Apply for citizenship conservative
## 38  Apply for citizenship conservative
## 39  Apply for citizenship conservative
## 40  Apply for citizenship conservative
## 41  Apply for citizenship conservative
## 42  Apply for citizenship conservative
## 43  Apply for citizenship conservative
## 44  Apply for citizenship conservative
## 45  Apply for citizenship conservative
## 46  Apply for citizenship conservative
## 47  Apply for citizenship conservative
## 48  Apply for citizenship conservative
## 49  Apply for citizenship conservative
## 50  Apply for citizenship conservative
## 51  Apply for citizenship conservative
## 52  Apply for citizenship conservative
## 53  Apply for citizenship conservative
## 54  Apply for citizenship conservative
## 55  Apply for citizenship conservative
## 56  Apply for citizenship conservative
## 57  Apply for citizenship conservative
## 58  Apply for citizenship     moderate
## 59  Apply for citizenship     moderate
## 60  Apply for citizenship     moderate
## 61  Apply for citizenship     moderate
## 62  Apply for citizenship     moderate
## 63  Apply for citizenship     moderate
## 64  Apply for citizenship     moderate
## 65  Apply for citizenship     moderate
## 66  Apply for citizenship     moderate
## 67  Apply for citizenship     moderate
## 68  Apply for citizenship     moderate
## 69  Apply for citizenship     moderate
## 70  Apply for citizenship     moderate
## 71  Apply for citizenship     moderate
## 72  Apply for citizenship     moderate
## 73  Apply for citizenship     moderate
## 74  Apply for citizenship     moderate
## 75  Apply for citizenship     moderate
## 76  Apply for citizenship     moderate
## 77  Apply for citizenship     moderate
## 78  Apply for citizenship     moderate
## 79  Apply for citizenship     moderate
## 80  Apply for citizenship     moderate
## 81  Apply for citizenship     moderate
## 82  Apply for citizenship     moderate
## 83  Apply for citizenship     moderate
## 84  Apply for citizenship     moderate
## 85  Apply for citizenship     moderate
## 86  Apply for citizenship     moderate
## 87  Apply for citizenship     moderate
## 88  Apply for citizenship     moderate
## 89  Apply for citizenship     moderate
## 90  Apply for citizenship     moderate
## 91  Apply for citizenship     moderate
## 92  Apply for citizenship     moderate
## 93  Apply for citizenship     moderate
## 94  Apply for citizenship     moderate
## 95  Apply for citizenship     moderate
## 96  Apply for citizenship     moderate
## 97  Apply for citizenship     moderate
## 98  Apply for citizenship     moderate
## 99  Apply for citizenship     moderate
## 100 Apply for citizenship     moderate
## 101 Apply for citizenship     moderate
## 102 Apply for citizenship     moderate
## 103 Apply for citizenship     moderate
## 104 Apply for citizenship     moderate
## 105 Apply for citizenship     moderate
## 106 Apply for citizenship     moderate
## 107 Apply for citizenship     moderate
## 108 Apply for citizenship     moderate
## 109 Apply for citizenship     moderate
## 110 Apply for citizenship     moderate
## 111 Apply for citizenship     moderate
## 112 Apply for citizenship     moderate
## 113 Apply for citizenship     moderate
## 114 Apply for citizenship     moderate
## 115 Apply for citizenship     moderate
## 116 Apply for citizenship     moderate
## 117 Apply for citizenship     moderate
## 118 Apply for citizenship     moderate
## 119 Apply for citizenship     moderate
## 120 Apply for citizenship     moderate
## 121 Apply for citizenship     moderate
## 122 Apply for citizenship     moderate
## 123 Apply for citizenship     moderate
## 124 Apply for citizenship     moderate
## 125 Apply for citizenship     moderate
## 126 Apply for citizenship     moderate
## 127 Apply for citizenship     moderate
## 128 Apply for citizenship     moderate
## 129 Apply for citizenship     moderate
## 130 Apply for citizenship     moderate
## 131 Apply for citizenship     moderate
## 132 Apply for citizenship     moderate
## 133 Apply for citizenship     moderate
## 134 Apply for citizenship     moderate
## 135 Apply for citizenship     moderate
## 136 Apply for citizenship     moderate
## 137 Apply for citizenship     moderate
## 138 Apply for citizenship     moderate
## 139 Apply for citizenship     moderate
## 140 Apply for citizenship     moderate
## 141 Apply for citizenship     moderate
## 142 Apply for citizenship     moderate
## 143 Apply for citizenship     moderate
## 144 Apply for citizenship     moderate
## 145 Apply for citizenship     moderate
## 146 Apply for citizenship     moderate
## 147 Apply for citizenship     moderate
## 148 Apply for citizenship     moderate
## 149 Apply for citizenship     moderate
## 150 Apply for citizenship     moderate
## 151 Apply for citizenship     moderate
## 152 Apply for citizenship     moderate
## 153 Apply for citizenship     moderate
## 154 Apply for citizenship     moderate
## 155 Apply for citizenship     moderate
## 156 Apply for citizenship     moderate
## 157 Apply for citizenship     moderate
## 158 Apply for citizenship     moderate
## 159 Apply for citizenship     moderate
## 160 Apply for citizenship     moderate
## 161 Apply for citizenship     moderate
## 162 Apply for citizenship     moderate
## 163 Apply for citizenship     moderate
## 164 Apply for citizenship     moderate
## 165 Apply for citizenship     moderate
## 166 Apply for citizenship     moderate
## 167 Apply for citizenship     moderate
## 168 Apply for citizenship     moderate
## 169 Apply for citizenship     moderate
## 170 Apply for citizenship     moderate
## 171 Apply for citizenship     moderate
## 172 Apply for citizenship     moderate
## 173 Apply for citizenship     moderate
## 174 Apply for citizenship     moderate
## 175 Apply for citizenship     moderate
## 176 Apply for citizenship     moderate
## 177 Apply for citizenship     moderate
## 178 Apply for citizenship      liberal
## 179 Apply for citizenship      liberal
## 180 Apply for citizenship      liberal
## 181 Apply for citizenship      liberal
## 182 Apply for citizenship      liberal
## 183 Apply for citizenship      liberal
## 184 Apply for citizenship      liberal
## 185 Apply for citizenship      liberal
## 186 Apply for citizenship      liberal
## 187 Apply for citizenship      liberal
## 188 Apply for citizenship      liberal
## 189 Apply for citizenship      liberal
## 190 Apply for citizenship      liberal
## 191 Apply for citizenship      liberal
## 192 Apply for citizenship      liberal
## 193 Apply for citizenship      liberal
## 194 Apply for citizenship      liberal
## 195 Apply for citizenship      liberal
## 196 Apply for citizenship      liberal
## 197 Apply for citizenship      liberal
## 198 Apply for citizenship      liberal
## 199 Apply for citizenship      liberal
## 200 Apply for citizenship      liberal
## 201 Apply for citizenship      liberal
## 202 Apply for citizenship      liberal
## 203 Apply for citizenship      liberal
## 204 Apply for citizenship      liberal
## 205 Apply for citizenship      liberal
## 206 Apply for citizenship      liberal
## 207 Apply for citizenship      liberal
## 208 Apply for citizenship      liberal
## 209 Apply for citizenship      liberal
## 210 Apply for citizenship      liberal
## 211 Apply for citizenship      liberal
## 212 Apply for citizenship      liberal
## 213 Apply for citizenship      liberal
## 214 Apply for citizenship      liberal
## 215 Apply for citizenship      liberal
## 216 Apply for citizenship      liberal
## 217 Apply for citizenship      liberal
## 218 Apply for citizenship      liberal
## 219 Apply for citizenship      liberal
## 220 Apply for citizenship      liberal
## 221 Apply for citizenship      liberal
## 222 Apply for citizenship      liberal
## 223 Apply for citizenship      liberal
## 224 Apply for citizenship      liberal
## 225 Apply for citizenship      liberal
## 226 Apply for citizenship      liberal
## 227 Apply for citizenship      liberal
## 228 Apply for citizenship      liberal
## 229 Apply for citizenship      liberal
## 230 Apply for citizenship      liberal
## 231 Apply for citizenship      liberal
## 232 Apply for citizenship      liberal
## 233 Apply for citizenship      liberal
## 234 Apply for citizenship      liberal
## 235 Apply for citizenship      liberal
## 236 Apply for citizenship      liberal
## 237 Apply for citizenship      liberal
## 238 Apply for citizenship      liberal
## 239 Apply for citizenship      liberal
## 240 Apply for citizenship      liberal
## 241 Apply for citizenship      liberal
## 242 Apply for citizenship      liberal
## 243 Apply for citizenship      liberal
## 244 Apply for citizenship      liberal
## 245 Apply for citizenship      liberal
## 246 Apply for citizenship      liberal
## 247 Apply for citizenship      liberal
## 248 Apply for citizenship      liberal
## 249 Apply for citizenship      liberal
## 250 Apply for citizenship      liberal
## 251 Apply for citizenship      liberal
## 252 Apply for citizenship      liberal
## 253 Apply for citizenship      liberal
## 254 Apply for citizenship      liberal
## 255 Apply for citizenship      liberal
## 256 Apply for citizenship      liberal
## 257 Apply for citizenship      liberal
## 258 Apply for citizenship      liberal
## 259 Apply for citizenship      liberal
## 260 Apply for citizenship      liberal
## 261 Apply for citizenship      liberal
## 262 Apply for citizenship      liberal
## 263 Apply for citizenship      liberal
## 264 Apply for citizenship      liberal
## 265 Apply for citizenship      liberal
## 266 Apply for citizenship      liberal
## 267 Apply for citizenship      liberal
## 268 Apply for citizenship      liberal
## 269 Apply for citizenship      liberal
## 270 Apply for citizenship      liberal
## 271 Apply for citizenship      liberal
## 272 Apply for citizenship      liberal
## 273 Apply for citizenship      liberal
## 274 Apply for citizenship      liberal
## 275 Apply for citizenship      liberal
## 276 Apply for citizenship      liberal
## 277 Apply for citizenship      liberal
## 278 Apply for citizenship      liberal
## 279          Guest worker conservative
## 280          Guest worker conservative
## 281          Guest worker conservative
## 282          Guest worker conservative
## 283          Guest worker conservative
## 284          Guest worker conservative
## 285          Guest worker conservative
## 286          Guest worker conservative
## 287          Guest worker conservative
## 288          Guest worker conservative
## 289          Guest worker conservative
## 290          Guest worker conservative
## 291          Guest worker conservative
## 292          Guest worker conservative
## 293          Guest worker conservative
## 294          Guest worker conservative
## 295          Guest worker conservative
## 296          Guest worker conservative
## 297          Guest worker conservative
## 298          Guest worker conservative
## 299          Guest worker conservative
## 300          Guest worker conservative
## 301          Guest worker conservative
## 302          Guest worker conservative
## 303          Guest worker conservative
## 304          Guest worker conservative
## 305          Guest worker conservative
## 306          Guest worker conservative
## 307          Guest worker conservative
## 308          Guest worker conservative
## 309          Guest worker conservative
## 310          Guest worker conservative
## 311          Guest worker conservative
## 312          Guest worker conservative
## 313          Guest worker conservative
## 314          Guest worker conservative
## 315          Guest worker conservative
## 316          Guest worker conservative
## 317          Guest worker conservative
## 318          Guest worker conservative
## 319          Guest worker conservative
## 320          Guest worker conservative
## 321          Guest worker conservative
## 322          Guest worker conservative
## 323          Guest worker conservative
## 324          Guest worker conservative
## 325          Guest worker conservative
## 326          Guest worker conservative
## 327          Guest worker conservative
## 328          Guest worker conservative
## 329          Guest worker conservative
## 330          Guest worker conservative
## 331          Guest worker conservative
## 332          Guest worker conservative
## 333          Guest worker conservative
## 334          Guest worker conservative
## 335          Guest worker conservative
## 336          Guest worker conservative
## 337          Guest worker conservative
## 338          Guest worker conservative
## 339          Guest worker conservative
## 340          Guest worker conservative
## 341          Guest worker conservative
## 342          Guest worker conservative
## 343          Guest worker conservative
## 344          Guest worker conservative
## 345          Guest worker conservative
## 346          Guest worker conservative
## 347          Guest worker conservative
## 348          Guest worker conservative
## 349          Guest worker conservative
## 350          Guest worker conservative
## 351          Guest worker conservative
## 352          Guest worker conservative
## 353          Guest worker conservative
## 354          Guest worker conservative
## 355          Guest worker conservative
## 356          Guest worker conservative
## 357          Guest worker conservative
## 358          Guest worker conservative
## 359          Guest worker conservative
## 360          Guest worker conservative
## 361          Guest worker conservative
## 362          Guest worker conservative
## 363          Guest worker conservative
## 364          Guest worker conservative
## 365          Guest worker conservative
## 366          Guest worker conservative
## 367          Guest worker conservative
## 368          Guest worker conservative
## 369          Guest worker conservative
## 370          Guest worker conservative
## 371          Guest worker conservative
## 372          Guest worker conservative
## 373          Guest worker conservative
## 374          Guest worker conservative
## 375          Guest worker conservative
## 376          Guest worker conservative
## 377          Guest worker conservative
## 378          Guest worker conservative
## 379          Guest worker conservative
## 380          Guest worker conservative
## 381          Guest worker conservative
## 382          Guest worker conservative
## 383          Guest worker conservative
## 384          Guest worker conservative
## 385          Guest worker conservative
## 386          Guest worker conservative
## 387          Guest worker conservative
## 388          Guest worker conservative
## 389          Guest worker conservative
## 390          Guest worker conservative
## 391          Guest worker conservative
## 392          Guest worker conservative
## 393          Guest worker conservative
## 394          Guest worker conservative
## 395          Guest worker conservative
## 396          Guest worker conservative
## 397          Guest worker conservative
## 398          Guest worker conservative
## 399          Guest worker conservative
## 400          Guest worker     moderate
## 401          Guest worker     moderate
## 402          Guest worker     moderate
## 403          Guest worker     moderate
## 404          Guest worker     moderate
## 405          Guest worker     moderate
## 406          Guest worker     moderate
## 407          Guest worker     moderate
## 408          Guest worker     moderate
## 409          Guest worker     moderate
## 410          Guest worker     moderate
## 411          Guest worker     moderate
## 412          Guest worker     moderate
## 413          Guest worker     moderate
## 414          Guest worker     moderate
## 415          Guest worker     moderate
## 416          Guest worker     moderate
## 417          Guest worker     moderate
## 418          Guest worker     moderate
## 419          Guest worker     moderate
## 420          Guest worker     moderate
## 421          Guest worker     moderate
## 422          Guest worker     moderate
## 423          Guest worker     moderate
## 424          Guest worker     moderate
## 425          Guest worker     moderate
## 426          Guest worker     moderate
## 427          Guest worker     moderate
## 428          Guest worker     moderate
## 429          Guest worker     moderate
## 430          Guest worker     moderate
## 431          Guest worker     moderate
## 432          Guest worker     moderate
## 433          Guest worker     moderate
## 434          Guest worker     moderate
## 435          Guest worker     moderate
## 436          Guest worker     moderate
## 437          Guest worker     moderate
## 438          Guest worker     moderate
## 439          Guest worker     moderate
## 440          Guest worker     moderate
## 441          Guest worker     moderate
## 442          Guest worker     moderate
## 443          Guest worker     moderate
## 444          Guest worker     moderate
## 445          Guest worker     moderate
## 446          Guest worker     moderate
## 447          Guest worker     moderate
## 448          Guest worker     moderate
## 449          Guest worker     moderate
## 450          Guest worker     moderate
## 451          Guest worker     moderate
## 452          Guest worker     moderate
## 453          Guest worker     moderate
## 454          Guest worker     moderate
## 455          Guest worker     moderate
## 456          Guest worker     moderate
## 457          Guest worker     moderate
## 458          Guest worker     moderate
## 459          Guest worker     moderate
## 460          Guest worker     moderate
## 461          Guest worker     moderate
## 462          Guest worker     moderate
## 463          Guest worker     moderate
## 464          Guest worker     moderate
## 465          Guest worker     moderate
## 466          Guest worker     moderate
## 467          Guest worker     moderate
## 468          Guest worker     moderate
## 469          Guest worker     moderate
## 470          Guest worker     moderate
## 471          Guest worker     moderate
## 472          Guest worker     moderate
## 473          Guest worker     moderate
## 474          Guest worker     moderate
## 475          Guest worker     moderate
## 476          Guest worker     moderate
## 477          Guest worker     moderate
## 478          Guest worker     moderate
## 479          Guest worker     moderate
## 480          Guest worker     moderate
## 481          Guest worker     moderate
## 482          Guest worker     moderate
## 483          Guest worker     moderate
## 484          Guest worker     moderate
## 485          Guest worker     moderate
## 486          Guest worker     moderate
## 487          Guest worker     moderate
## 488          Guest worker     moderate
## 489          Guest worker     moderate
## 490          Guest worker     moderate
## 491          Guest worker     moderate
## 492          Guest worker     moderate
## 493          Guest worker     moderate
## 494          Guest worker     moderate
## 495          Guest worker     moderate
## 496          Guest worker     moderate
## 497          Guest worker     moderate
## 498          Guest worker     moderate
## 499          Guest worker     moderate
## 500          Guest worker     moderate
## 501          Guest worker     moderate
## 502          Guest worker     moderate
## 503          Guest worker     moderate
## 504          Guest worker     moderate
## 505          Guest worker     moderate
## 506          Guest worker     moderate
## 507          Guest worker     moderate
## 508          Guest worker     moderate
## 509          Guest worker     moderate
## 510          Guest worker     moderate
## 511          Guest worker     moderate
## 512          Guest worker     moderate
## 513          Guest worker      liberal
## 514          Guest worker      liberal
## 515          Guest worker      liberal
## 516          Guest worker      liberal
## 517          Guest worker      liberal
## 518          Guest worker      liberal
## 519          Guest worker      liberal
## 520          Guest worker      liberal
## 521          Guest worker      liberal
## 522          Guest worker      liberal
## 523          Guest worker      liberal
## 524          Guest worker      liberal
## 525          Guest worker      liberal
## 526          Guest worker      liberal
## 527          Guest worker      liberal
## 528          Guest worker      liberal
## 529          Guest worker      liberal
## 530          Guest worker      liberal
## 531          Guest worker      liberal
## 532          Guest worker      liberal
## 533          Guest worker      liberal
## 534          Guest worker      liberal
## 535          Guest worker      liberal
## 536          Guest worker      liberal
## 537          Guest worker      liberal
## 538          Guest worker      liberal
## 539          Guest worker      liberal
## 540          Guest worker      liberal
## 541     Leave the country conservative
## 542     Leave the country conservative
## 543     Leave the country conservative
## 544     Leave the country conservative
## 545     Leave the country conservative
## 546     Leave the country conservative
## 547     Leave the country conservative
## 548     Leave the country conservative
## 549     Leave the country conservative
## 550     Leave the country conservative
## 551     Leave the country conservative
## 552     Leave the country conservative
## 553     Leave the country conservative
## 554     Leave the country conservative
## 555     Leave the country conservative
## 556     Leave the country conservative
## 557     Leave the country conservative
## 558     Leave the country conservative
## 559     Leave the country conservative
## 560     Leave the country conservative
## 561     Leave the country conservative
## 562     Leave the country conservative
## 563     Leave the country conservative
## 564     Leave the country conservative
## 565     Leave the country conservative
## 566     Leave the country conservative
## 567     Leave the country conservative
## 568     Leave the country conservative
## 569     Leave the country conservative
## 570     Leave the country conservative
## 571     Leave the country conservative
## 572     Leave the country conservative
## 573     Leave the country conservative
## 574     Leave the country conservative
## 575     Leave the country conservative
## 576     Leave the country conservative
## 577     Leave the country conservative
## 578     Leave the country conservative
## 579     Leave the country conservative
## 580     Leave the country conservative
## 581     Leave the country conservative
## 582     Leave the country conservative
## 583     Leave the country conservative
## 584     Leave the country conservative
## 585     Leave the country conservative
## 586     Leave the country conservative
## 587     Leave the country conservative
## 588     Leave the country conservative
## 589     Leave the country conservative
## 590     Leave the country conservative
## 591     Leave the country conservative
## 592     Leave the country conservative
## 593     Leave the country conservative
## 594     Leave the country conservative
## 595     Leave the country conservative
## 596     Leave the country conservative
## 597     Leave the country conservative
## 598     Leave the country conservative
## 599     Leave the country conservative
## 600     Leave the country conservative
## 601     Leave the country conservative
## 602     Leave the country conservative
## 603     Leave the country conservative
## 604     Leave the country conservative
## 605     Leave the country conservative
## 606     Leave the country conservative
## 607     Leave the country conservative
## 608     Leave the country conservative
## 609     Leave the country conservative
## 610     Leave the country conservative
## 611     Leave the country conservative
## 612     Leave the country conservative
## 613     Leave the country conservative
## 614     Leave the country conservative
## 615     Leave the country conservative
## 616     Leave the country conservative
## 617     Leave the country conservative
## 618     Leave the country conservative
## 619     Leave the country conservative
## 620     Leave the country conservative
## 621     Leave the country conservative
## 622     Leave the country conservative
## 623     Leave the country conservative
## 624     Leave the country conservative
## 625     Leave the country conservative
## 626     Leave the country conservative
## 627     Leave the country conservative
## 628     Leave the country conservative
## 629     Leave the country conservative
## 630     Leave the country conservative
## 631     Leave the country conservative
## 632     Leave the country conservative
## 633     Leave the country conservative
## 634     Leave the country conservative
## 635     Leave the country conservative
## 636     Leave the country conservative
## 637     Leave the country conservative
## 638     Leave the country conservative
## 639     Leave the country conservative
## 640     Leave the country conservative
## 641     Leave the country conservative
## 642     Leave the country conservative
## 643     Leave the country conservative
## 644     Leave the country conservative
## 645     Leave the country conservative
## 646     Leave the country conservative
## 647     Leave the country conservative
## 648     Leave the country conservative
## 649     Leave the country conservative
## 650     Leave the country conservative
## 651     Leave the country conservative
## 652     Leave the country conservative
## 653     Leave the country conservative
## 654     Leave the country conservative
## 655     Leave the country conservative
## 656     Leave the country conservative
## 657     Leave the country conservative
## 658     Leave the country conservative
## 659     Leave the country conservative
## 660     Leave the country conservative
## 661     Leave the country conservative
## 662     Leave the country conservative
## 663     Leave the country conservative
## 664     Leave the country conservative
## 665     Leave the country conservative
## 666     Leave the country conservative
## 667     Leave the country conservative
## 668     Leave the country conservative
## 669     Leave the country conservative
## 670     Leave the country conservative
## 671     Leave the country conservative
## 672     Leave the country conservative
## 673     Leave the country conservative
## 674     Leave the country conservative
## 675     Leave the country conservative
## 676     Leave the country conservative
## 677     Leave the country conservative
## 678     Leave the country conservative
## 679     Leave the country conservative
## 680     Leave the country conservative
## 681     Leave the country conservative
## 682     Leave the country conservative
## 683     Leave the country conservative
## 684     Leave the country conservative
## 685     Leave the country conservative
## 686     Leave the country conservative
## 687     Leave the country conservative
## 688     Leave the country conservative
## 689     Leave the country conservative
## 690     Leave the country conservative
## 691     Leave the country conservative
## 692     Leave the country conservative
## 693     Leave the country conservative
## 694     Leave the country conservative
## 695     Leave the country conservative
## 696     Leave the country conservative
## 697     Leave the country conservative
## 698     Leave the country conservative
## 699     Leave the country conservative
## 700     Leave the country conservative
## 701     Leave the country conservative
## 702     Leave the country conservative
## 703     Leave the country conservative
## 704     Leave the country conservative
## 705     Leave the country conservative
## 706     Leave the country conservative
## 707     Leave the country conservative
## 708     Leave the country conservative
## 709     Leave the country conservative
## 710     Leave the country conservative
## 711     Leave the country conservative
## 712     Leave the country conservative
## 713     Leave the country conservative
## 714     Leave the country conservative
## 715     Leave the country conservative
## 716     Leave the country conservative
## 717     Leave the country conservative
## 718     Leave the country conservative
## 719     Leave the country conservative
## 720     Leave the country     moderate
## 721     Leave the country     moderate
## 722     Leave the country     moderate
## 723     Leave the country     moderate
## 724     Leave the country     moderate
## 725     Leave the country     moderate
## 726     Leave the country     moderate
## 727     Leave the country     moderate
## 728     Leave the country     moderate
## 729     Leave the country     moderate
## 730     Leave the country     moderate
## 731     Leave the country     moderate
## 732     Leave the country     moderate
## 733     Leave the country     moderate
## 734     Leave the country     moderate
## 735     Leave the country     moderate
## 736     Leave the country     moderate
## 737     Leave the country     moderate
## 738     Leave the country     moderate
## 739     Leave the country     moderate
## 740     Leave the country     moderate
## 741     Leave the country     moderate
## 742     Leave the country     moderate
## 743     Leave the country     moderate
## 744     Leave the country     moderate
## 745     Leave the country     moderate
## 746     Leave the country     moderate
## 747     Leave the country     moderate
## 748     Leave the country     moderate
## 749     Leave the country     moderate
## 750     Leave the country     moderate
## 751     Leave the country     moderate
## 752     Leave the country     moderate
## 753     Leave the country     moderate
## 754     Leave the country     moderate
## 755     Leave the country     moderate
## 756     Leave the country     moderate
## 757     Leave the country     moderate
## 758     Leave the country     moderate
## 759     Leave the country     moderate
## 760     Leave the country     moderate
## 761     Leave the country     moderate
## 762     Leave the country     moderate
## 763     Leave the country     moderate
## 764     Leave the country     moderate
## 765     Leave the country     moderate
## 766     Leave the country     moderate
## 767     Leave the country     moderate
## 768     Leave the country     moderate
## 769     Leave the country     moderate
## 770     Leave the country     moderate
## 771     Leave the country     moderate
## 772     Leave the country     moderate
## 773     Leave the country     moderate
## 774     Leave the country     moderate
## 775     Leave the country     moderate
## 776     Leave the country     moderate
## 777     Leave the country     moderate
## 778     Leave the country     moderate
## 779     Leave the country     moderate
## 780     Leave the country     moderate
## 781     Leave the country     moderate
## 782     Leave the country     moderate
## 783     Leave the country     moderate
## 784     Leave the country     moderate
## 785     Leave the country     moderate
## 786     Leave the country     moderate
## 787     Leave the country     moderate
## 788     Leave the country     moderate
## 789     Leave the country     moderate
## 790     Leave the country     moderate
## 791     Leave the country     moderate
## 792     Leave the country     moderate
## 793     Leave the country     moderate
## 794     Leave the country     moderate
## 795     Leave the country     moderate
## 796     Leave the country     moderate
## 797     Leave the country     moderate
## 798     Leave the country     moderate
## 799     Leave the country     moderate
## 800     Leave the country     moderate
## 801     Leave the country     moderate
## 802     Leave the country     moderate
## 803     Leave the country     moderate
## 804     Leave the country     moderate
## 805     Leave the country     moderate
## 806     Leave the country     moderate
## 807     Leave the country     moderate
## 808     Leave the country     moderate
## 809     Leave the country     moderate
## 810     Leave the country     moderate
## 811     Leave the country     moderate
## 812     Leave the country     moderate
## 813     Leave the country     moderate
## 814     Leave the country     moderate
## 815     Leave the country     moderate
## 816     Leave the country     moderate
## 817     Leave the country     moderate
## 818     Leave the country     moderate
## 819     Leave the country     moderate
## 820     Leave the country     moderate
## 821     Leave the country     moderate
## 822     Leave the country     moderate
## 823     Leave the country     moderate
## 824     Leave the country     moderate
## 825     Leave the country     moderate
## 826     Leave the country     moderate
## 827     Leave the country     moderate
## 828     Leave the country     moderate
## 829     Leave the country     moderate
## 830     Leave the country     moderate
## 831     Leave the country     moderate
## 832     Leave the country     moderate
## 833     Leave the country     moderate
## 834     Leave the country     moderate
## 835     Leave the country     moderate
## 836     Leave the country     moderate
## 837     Leave the country     moderate
## 838     Leave the country     moderate
## 839     Leave the country     moderate
## 840     Leave the country     moderate
## 841     Leave the country     moderate
## 842     Leave the country     moderate
## 843     Leave the country     moderate
## 844     Leave the country     moderate
## 845     Leave the country     moderate
## 846     Leave the country      liberal
## 847     Leave the country      liberal
## 848     Leave the country      liberal
## 849     Leave the country      liberal
## 850     Leave the country      liberal
## 851     Leave the country      liberal
## 852     Leave the country      liberal
## 853     Leave the country      liberal
## 854     Leave the country      liberal
## 855     Leave the country      liberal
## 856     Leave the country      liberal
## 857     Leave the country      liberal
## 858     Leave the country      liberal
## 859     Leave the country      liberal
## 860     Leave the country      liberal
## 861     Leave the country      liberal
## 862     Leave the country      liberal
## 863     Leave the country      liberal
## 864     Leave the country      liberal
## 865     Leave the country      liberal
## 866     Leave the country      liberal
## 867     Leave the country      liberal
## 868     Leave the country      liberal
## 869     Leave the country      liberal
## 870     Leave the country      liberal
## 871     Leave the country      liberal
## 872     Leave the country      liberal
## 873     Leave the country      liberal
## 874     Leave the country      liberal
## 875     Leave the country      liberal
## 876     Leave the country      liberal
## 877     Leave the country      liberal
## 878     Leave the country      liberal
## 879     Leave the country      liberal
## 880     Leave the country      liberal
## 881     Leave the country      liberal
## 882     Leave the country      liberal
## 883     Leave the country      liberal
## 884     Leave the country      liberal
## 885     Leave the country      liberal
## 886     Leave the country      liberal
## 887     Leave the country      liberal
## 888     Leave the country      liberal
## 889     Leave the country      liberal
## 890     Leave the country      liberal

Count responses by political ideology

response_counts <- clean_data %>%
  group_by(political, response) %>%
  summarise(count = n())
## `summarise()` has grouped output by 'political'. You can override using the
## `.groups` argument.
print(response_counts)
## # A tibble: 9 × 3
## # Groups:   political [3]
##   political    response              count
##   <chr>        <chr>                 <int>
## 1 conservative Apply for citizenship    57
## 2 conservative Guest worker            121
## 3 conservative Leave the country       179
## 4 liberal      Apply for citizenship   101
## 5 liberal      Guest worker             28
## 6 liberal      Leave the country        45
## 7 moderate     Apply for citizenship   120
## 8 moderate     Guest worker            113
## 9 moderate     Leave the country       126

Bar plot to visualize the results

library(ggplot2)

ggplot(response_counts, aes(x = political, y = count, fill = response)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Opinions on Illegal Workers by Political Ideology",
       x = "Political Ideology", y = "Number of Respondents",
       fill = "Response") +
  theme_minimal()

Overall political ideology distribution

table(immigration$political)
## 
## conservative      liberal     moderate 
##          372          175          363

Conclusion

The analysis shows that political ideology is strongly associated with opinions on how to handle illegal workers. Liberal respondents were much more likely to support allowing illegal workers to apply for citizenship. In contrast, conservatives were more likely to believe these workers should leave the country. Moderates tended to fall between the two, often favoring the guest worker option.

Future Directions

Although this dataset offers valuable insight into the views of Tampa voters, it would be beneficial to compare this data across other cities or states to see if these patterns hold nationally. Future studies could also include additional variables such as age, race, education, or income to better understand the influences behind people’s views on immigration policy.

References