Anne Etienne-Hw2

Read in a dataset, Explain the variables in your dataset, Finally, demonstrate your knowledge of dplyr by using filter, arrange, and/or select to perform at least 2 basic data-wrangling operations.

Anne Etienne
2022-04-20

In this assignment, I will be reading the tidy dataset below in CSV involving 53 states and the total of employees for each state.

There are two variables in this dataset. State: String with nominal data , Total_employees: continuous with real numbers

railroad2012<-read_csv("../Documents/railroad2012.csv") #assigning dataset to variable

DATA WRANGLING USING DPLYR PACKAGE; USING THE ARRANGE AND FILTER FUNCTIONS.

arrange(railroad2012, desc(total_employees)) #arranging States in a descending manner.
# A tibble: 53 x 2
   state total_employees
   <chr>           <dbl>
 1 TX              19839
 2 IL              19131
 3 NY              17050
 4 NE              13176
 5 CA              13137
 6 PA              12769
 7 OH               9056
 8 GA               8605
 9 IN               8537
10 MO               8419
# ... with 43 more rows
railroad2012 %>% filter(total_employees < 100)%>% arrange(desc(total_employees)) #filter out states with total employees less than 100, arranged in a descending manner.
# A tibble: 3 x 2
  state total_employees
  <chr>           <dbl>
1 HI                  4
2 AE                  2
3 AP                  1

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Etienne (2022, April 27). Data Analytics and Computational Social Science: Anne Etienne-Hw2. Retrieved from https://github.com/DACSS/dacss_course_website/posts/httprpubscomanneetienne893400/

BibTeX citation

@misc{etienne2022anne,
  author = {Etienne, Anne},
  title = {Data Analytics and Computational Social Science: Anne Etienne-Hw2},
  url = {https://github.com/DACSS/dacss_course_website/posts/httprpubscomanneetienne893400/},
  year = {2022}
}