Homework 1, trying to get a blog up without breaking the whole class website.
My introduction information was included on the post card excercise, so how about a little aside first? I’ve always preferred to write in a conversational tone. This is a much more common approach in my professional environs to which I’ve grown accustomed. Obviously, this a poor fit for the academic world. I promise I will return to using only my most serious and authoritative written voice tout suite. Well, probably not right away, but as soon as I feel like I know what I’m doing here and not breaking things.
I plan on attempting to read in some of the messy data sets in the next installment of the blog, but for getting the hang of things here I think it’s best for us all if I do some things with the training wheels on first.
Let’s start with an R code chunk doing some basic stuff while showing the R code along with it.
# Making up a vector for liverpool football club goals scored
liverpool_goals <- c(2,1,3,4)
# Getting the mean of the made up vector of LFC goals
mean(liverpool_goals)
[1] 2.5
That seems to have worked! Alright, let’s take another baby step forward. Let’s try and get the already cleaned up Australian marriage data file into this post and look at some of the columns.
# Loading in and assigning in the Australian marriage data. I copied the .csv from the existing _data folder to the files folder for this post. Hopefully that's the right thing to do!
australian_marriage_data <- read_csv(file = "lets-try-a-blog-shall-we_files/australian_marriage_tidy.csv")
australian_marriage_data
# A tibble: 16 x 4
territory resp count percent
<chr> <chr> <dbl> <dbl>
1 New South Wales yes 2374362 57.8
2 New South Wales no 1736838 42.2
3 Victoria yes 2145629 64.9
4 Victoria no 1161098 35.1
5 Queensland yes 1487060 60.7
6 Queensland no 961015 39.3
7 South Australia yes 592528 62.5
8 South Australia no 356247 37.5
9 Western Australia yes 801575 63.7
10 Western Australia no 455924 36.3
11 Tasmania yes 191948 63.6
12 Tasmania no 109655 36.4
13 Northern Territory(b) yes 48686 60.6
14 Northern Territory(b) no 31690 39.4
15 Australian Capital Territory(c) yes 175459 74
16 Australian Capital Territory(c) no 61520 26
If there’s a table above this sentence, then that’s just a little bit of internet magic. The thing about tables, though, is that sometimes it becomes hard to see the forest for the trees. Some graphs, then? I want to just look at the percent of yes votes by territory from the overall data set.
#set a data frame from a portion of the tidy spreadsheet, filtering to yes votes
australian_filter <- filter(australian_marriage_data, resp == "yes")
#using select to drop the variable I don't want to look at
australian_df <- select(australian_filter, -(resp:count))
#simple scatter plot of the yes vote percentage for each territory
ggplot(data = australian_df) +
geom_point(mapping = aes(x = territory, y = percent))
I’ll come back to do something more interesting and coherent for analysis in a future installment, but I’m already starting to feel a lot more comfortable with the R verbiage and such. I’m sure there were more efficient ways to make that graph but we’ll get to that later I’m sure.
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 ...".
For attribution, please cite this work as
Davis (2021, Sept. 14). DACSS 601 Fall 2021: Let's try a blog, shall we?. Retrieved from https://mrolfe.github.io/DACSS601Fall21/posts/2021-09-15-lets-try-a-blog-shall-we/
BibTeX citation
@misc{davis2021let's, author = {Davis, Joe}, title = {DACSS 601 Fall 2021: Let's try a blog, shall we?}, url = {https://mrolfe.github.io/DACSS601Fall21/posts/2021-09-15-lets-try-a-blog-shall-we/}, year = {2021} }