Skip to content

Commit

Permalink
Adding week 02 homework and data
Browse files Browse the repository at this point in the history
  • Loading branch information
eveskew committed Feb 6, 2020
1 parent 9cb289e commit 699ab57
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/orangutans.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"individual","location","weight_kg","sex","tool_use"
"A","Borneo",105,"male",TRUE
"B","Borneo",72,"male",FALSE
"C","Borneo",60,"male",FALSE
"D","Borneo",43,"female",TRUE
"E","Borneo",41,"female",TRUE
"F","Borneo",38,"female",TRUE
"G","Borneo",33,"female",FALSE
"H","Sumatra",110,"male",FALSE
"I","Sumatra",81,"male",FALSE
"J","Sumatra",77,"male",TRUE
"K","Sumatra",42,"female",TRUE
"L","Sumatra",38,"female",TRUE
"M","Sumatra",37,"female",FALSE
"N","Sumatra",32,"female",TRUE
"O","Sumatra",30,"female",FALSE
61 changes: 61 additions & 0 deletions homework/hw_week_02.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "EEEB UN3005/GR5005 \nHomework - Week 02 - Due 11 Feb 2020"
author: "USE THE NUMERIC PORTION OF YOUR UNI HERE"
output: pdf_document
fontsize: 12pt
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
```


**Homework Instructions:** Complete this assignment by writing code in the code chunks provided. If required, provide written explanations below the relevant code chunks. Replace "USE THE NUMERIC PORTION OF YOUR UNI HERE" in the document header with the numbers appearing in your UNI. When complete, knit this document within RStudio to generate a PDF file. Please review the resulting PDF to ensure that all content relevant for grading (i.e., code, code output, and written explanations) appears in the document. Rename your PDF document according to the following format: hw_week_02_UNInumbers.pdf. Upload this final homework document to CourseWorks by 5 pm on the due date.


## Problem 1 (1 point)

On the class CourseWorks site you'll find a dataset called `orangutans.csv`. This file contains hypothetical data on weight, sex, and observed tool use for orangutans from Sumatra and Borneo. Import this data into R, assigning the data to an object called `orangutans`. Use a summary function of your choice to get an idea of the data structure you're working with. Which variable(s) in the data represent numeric data?

```{r}
```


## Problem 2 (2 points)

Using `dplyr` functionality, return all rows of data for female orangutans. Perform the same operation using bracket subsetting (i.e., the base R solution).

```{r}
```


## Problem 3 (2 points)

Using `dplyr` functionality, return all rows of data that correspond to orangutans sampled from Sumatra that are less than 80 kg in weight.

```{r}
```


## Problem 4 (2 points)

Using `dplyr` functionality, sort the `orangutans` data frame according to weight, from high to low, and return only the `individual` and `weight_kg` variables.

```{r}
```


## Problem 5 (3 points)

Using `dplyr` functionality, calculate the mean weight for orangutans of each sex in each in location. In other words, you should be returning one mean weight value for each of the following groups: females from Borneo, females from Sumatra, males from Borneo, and males from Sumatra.

```{r}
```

0 comments on commit 699ab57

Please sign in to comment.