Lab 6 Bio 1002 - Biology 1002 Lab 6 PDF

Title Lab 6 Bio 1002 - Biology 1002 Lab 6
Author Victoria Rose
Course Biology
Institution Memorial University of Newfoundland
Pages 8
File Size 241.2 KB
File Type PDF
Total Downloads 84
Total Views 127

Summary

Biology 1002 Lab 6...


Description

BIOLOGY 1002 WINTER 2021 LAB 6 ORGANIZING and MANAGING BIOLOGICAL DATA SETS PART I Name: Victoria Rose Student number: 201967379 INSTRUCTIONS: 1.

During this lab it is important to have RStudio (or RStudio Cloud), the Managing and Organizing Biological Data Sets Part 1 and the Lab 6 Worksheet all open on your computer at the same time.

2.

This worksheet simply has the HAND IN activities and questions lifted directly from Managing and Organizing Biological Data Sets Part 1 . Unless otherwise stated you are to include BOTH your CODE and OUTPUT. The simplest way to do this is to run your code and copy both from the console.

3.

DO NOT copy and paste information directly from Managing and Organizing Biological Data Sets Part 1 or other online materials when answering your questions. This will be considered plagiarism and you will receive a grade of zero with possible further disciplinary action as per the University Calendar. Your answers must be in your own words. (This, of course, does not include the copying and pasting of your code and graphs from your R script or console.)

4.

SAVE your document frequently. Once completed, save your assignment as a PDF document and upload to the Assignment Folder entitled “Lab 6 Assignment” in the pulldown menu under Assessments. Your worksheet is due Friday March 5th at 5:00pm NL and is worth 2 % of your total lab mark.

5.

If you have any questions, please contact your lab instructor through Brightspace OR through regular MUN email.

6.

If you experience technical difficulties with your upload, contact the Client Support Team of the Centre for Innovation in Teaching and Learning at www.citl.mun.ca/support

Notice from Memorial University: You agree to the following; “All members of the Memorial University of Newfoundland community, including students, faculty, and staff, shall treat others with respect and fairness, be responsible and honest, and uphold the highest standards of academic integrity. By submitting this assignment, I unequivocally state that all work is entirely my own and does not violate Memorial University's Academic Integrity policy.”

1.1 Lab 1: Data in Tables 1.1.1 Shrub Volume Data Basic Using the select function HAND IN Now on your own, in addition to printing the length column, select and print the site and experiment columns. (2.0 marks) EXAMPLE LENGTH select (ShrubData, length) length 1 2.2 2 2.1 3 2.7 4 3.0 5 3.1 6 2.5 7 1.9 8 1.1 9 3.5 10 2.9 11 4.5 12 1.2

SITE Select (ShrubData, site) site 1 1 2 1 3 1 4 2 5 2 6 2 7 3 8 3 9 3 10 4 11 4 12 4

EXPERIMENT Select (ShrubData, experiment) experiment 1 1 2 2 3 3 4 1 5 2 6 3 7 1 8 2 9 3 10 1 11 2 12 3

Adding a new column HAND IN Using the mutate function, create a column called area . Reminder, area of a square is equal to the length * width. (1.0 marks) mutate(ShrubData, site_double = site * 2, area = length * width) site experiment length width height site_double area 1 2 3 4 1 6 7 8 9 10 11 12

1 1 1 2 2 2 3 3 3 4 4 4

1 2 3 1 2 3 1 2 3 1 2 3

2.2 2.1 2.7 3.0 3.1 2.5 1.9 1.1 3.5 2.9 4.5 1.2

1.3 2.2 1.5 4.5 3.1 2.8 1.8 0.5 2.0 2.7 4.8 1.8

9.6 7.6 2.2 1.5 4.0 3.0 4.5 2.3 7.5 3.2 6.5 2.7

2 2.86 2 4.62 2 4.05 4 13.50 4 9.61 4 7.00 6 3.42 6 0.55 6 7.00 8 7.83 8 21.60 8 2.16

Sorting the data HAND IN Using the arrange function to sort the data based on the length column. (1.0 marks) arrange(ShrubData, length) Site Experiment Length Width Height 1

3

2

1.1

0.5

2.3

2

4

3

1.2

1.8

2.7

3

3

1

1.9

1.8

4.5

4

1

2

2.1

2.2

7.6

5

1

1

2.2

1.3

9.6

6

2

3

2.5

2.8

3.0

7

1

3

2.7

1.5

2.2

8

4

1

2.9

2.7

3.2

9

2

1

3.0

4.5

1.5

10

2

2

3.1

3.1

4.0

11

3

3

3.5

2.0

7.5

12

4

2

4.5

4.8

6.5

Filtering data HAND IN Using the filter function, filter the data to only include plants longer then 5 cm. (1.0 marks) > filter(ShrubData, length > 5) [1] site experiment length (or 0-length row.names)

width

*No Plants are more then 5cm in length. * filter(ShrubData, height > 5) site experiment length width height 1 1 1 2.2 1.3 9.6 2 1 2 2.1 2.2 7.6 3 3 3 3.5 2.0 7.5 4 4 2 4.5 4.8 6.5

height

HAND IN Using the filter function to show entries with plants with length greater then 4 and width greater then 2. (1.0 marks) filter(ShrubData, length > 4 & width > 2) site experiment length width height 1 4 2 4.5 4.8 6.5

HAND IN Using the filter function, filter the data to only include plants from experiment 1 or 2. (1.0 marks) > filter(ShrubData, experiment == 1| experiment == 2) site experiment length width height 1 1 1 2.2 1.3 9.6 2 1 2 2.1 2.2 7.6 3 2 1 3.0 4.5 1.5 4 2 2 3.1 3.1 4.0 5 3 1 1.9 1.8 4.5 6 3 2 1.1 0.5 2.3 7 4 1 2.9 2.7 3.2 8 4 2 4.5 4.8 6.5

HAND IN Create a new data frame called shrub_volume and include the tail() print out. (2.0 marks) shrub_volumes tail(shrub_volumes) site experiment length width height volumes 7 3 1 1.9 1.8 4.5 15.390 8 3 2 1.1 0.5 2.3 1.265 9 3 3 3.5 2.0 7.5 52.500 10 4 1 2.9 2.7 3.2 25.056 11 4 2 4.5 4.8 6.5 140.400 12 4 3 1.2 1.8 2.7 5.832

1.1.2 Code Shuffle HAND IN Using the weather_data, calculate the mean precipitation for each month and produce a simple line plot. Include both the R code and the plot. (4.0 marks) CODE > WeatherData col_means print(col_means) X587 X1124 X313 X736 X303 X2585 X2475 804.0526 883.6316 944.0263 569.1053 736.4211 1787.9737 1668.7105 X2720 X754 X246 X610 X246.1 1756.8947 1256.5263 667.0789 499.7632 698.6842 > plot.default(col_means, type = "l", xlab = "Month", ylab = "Mean Precipitation (ml)", main = "Average Precipitation in Gainesville, FL (1961-2013)")

GRAPH

1.1.3 Bird Banding HAND IN 1.

How many sites are there? (1.0 marks)

There are 61 sites. > length(number_of_birds)

2.

What is the total number of birds counted across all of the sites? (1.0 marks)

The total number of birds are 4366, counted across all of the sites. > sum(number_of_birds) [1] 4366

3.

What is the smallest number of birds counted? (1.0 marks)

The smallest number of birds counted is 0. > min(number_of_birds) [1] 0

4.

What is the largest number of birds counted? (1.0 marks)

The largest number of birds counted is 900. > max(number_of_birds) [1] 900

5.

What is the average number of birds seen at a site? (1.0 marks)

The average amount of birds seen at a site is 71.57377 or 72 rounded. > mean(number_of_birds) [1] 71.57377

6.

How many birds were counted at the last site? Have the computer choose the last site automatically in some way, not manually entering its position. Do you know a function that will give you a position of the last value? (since positions start at 1 position of the last value in a vector is the same as its length) (1.5 marks)

In the last site, there were 11 birds counted. > number_of_birds[61] [1] 11

7.

How many birds were counted at site 42? (1.5 marks)

In site 42 there were 83 birds counted > number_of_birds[42]

[1] 83

1.1.4 Portal Data Manipulation HAND IN Answer the following. 1.

Using the select() function create a new data frame called survey_new that only contains the columns year, month, day, and species_id in that order. (1.0 marks) INCLUDE CODE ONLY

> survey_new > > >

3.

survey_new1 head(filter(survey_new2, species_id == "SH"))

Use the head() function to lessen the number rows in your output.

1.1.5 Portal Data Manipulation Pipes HAND IN: Using the %>% operation, answer the following questions. 1.

Using the mutate(), select() , filter() , and/or !is.na() functions to create a new data frame with only year(), species_id and weight() in kilograms of each individual . (2.0 marks) INCLUDE CODE ONLY

> + + >

2.

> + + > >

survey_new3 % filter(!is.na(weight))%>% mutate(weight_kg = weight/1000) select(survey_new3, year, species_id, weight_kg)

Use the filter() and select() to get the year, month, day, weight in kg, and species_id columns for all of the rows in the data frame where species_id is SH. Use the head() command to print the top of the data frame. (2.0 marks) survey_new4 % filter(species_id == "SH")%>% mutate(weight_kg = weight/1000) select(survey_new4, year, month, day, weight_kg, species_id) head(select(survey_new4, year, month, day, weight_kg, species_id))

year month day weight_kg species_id 1 1977 7 17 NA SH 2 1978 11 4 0.089 SH 3 1982 5 21 0.106 SH 4 1982 6 29 0.052 SH 5 1983 3 14 NA SH 6 1983 4 16 NA SH...


Similar Free PDFs