Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an R Markdown file that provides complete, easy-to-read code for each of the following exercises. 1. The following data were collected from a matched

image text in transcribedimage text in transcribed
Create an R Markdown file that provides complete, easy-to-read code for each of the following exercises. 1. The following data were collected from a matched pairs experiment where each of four subjects received all three treatments. ds1 # # 1 1 Con 6. 25 ## 2 2 Con 5. 98 ## 3 3 Con 4. 79 ## 4 4 Con 4. 95 # # 5 1 Trt1 5. 94 ## 6 2 Trt1 4. 94 # # 7 3 Trt1 5. 96 # # 8 4 Trt1 5 . 28 # # 9 1 Trt2 5 . 86 ## 10 2 Trt2 5.31 ## 11 3 Trt2 4. 63 ## 12 4 Trt2 4. 29 1. (cont.) This format makes it difficult to calculate difference between the treatments. a. Rearrange the data to make it easier to calculate the difference between each treatment and the control for each subject. Call your new data set ds2 . b. Rearrange ds2 so that it is back in the same format as ds1o. Hearrange dsz so that It IS DacK In the same format as dsl . 2. The data set penguins_raw contains data collected on several species of penguins in Antarctica. (You will need to install and load the package palmerpenguins) a. The variable studyName contains an identifier of the particular study that produced the data for that penguin. Split that variable into two variables: one that contains the alphabetic portion and one that contains the numeric portion. b. The variable Individual ID has a format that starts with the letter N , followed by numbers, and then the letter A , and then more numbers. The numbers following the N indicate the nest number. Create a variable containing only the numbers immediately following the N. 3. Consider the babynames data set. (You will need to install and load the package babynames .) We would like to explore which names are the most gender-neutral. That is, which names have been used for both boys and girls in the most similar numbers. a. The first step is to count the number of times each name has been used by sex. I'll start you off: babynames %>% group_by(sex, name) %>% sumarize(total = sum(n)) 3. (cont.) b. This data set contains all names that have been used at least 5 times. We don't really care about names that have only been used a couple times. Let's only include names that have been used at least 10,000 times (you can play with this number if you want). 0. Now, to compare boys and girls, we need to reshape the data. Each name should have one row and in that row should be the number of girls with that name and the number of boys with that name. Rearrange the data in this way. d. You've now created many missing values (right?). We can remove all the names that have a missing value for either girls or boys. e. Now we need to create a new variable the measures how gender-neutral a name is. There are many ways to do this. I'll let you choose how you want to do it; just make sure it can be sorted in a way that will show the most gender-neutral names. (For example, a simple ratio won't work since the most genderneutral names would have a ratio of 1, but some names would be smaller and others larger, so sorting won't help.) Create your variable and sort your data to show the most gender-neutral names

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Calculus

Authors: R Creighton Buck

3rd Edition

147861613X, 9781478616139

More Books

Students also viewed these Mathematics questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago