Docsity

chem 1050 study guide, Summaries of Chemistry

Toggle sidebar
bg1
# Title: My R script for lab 6
# Author: Abby Brothers
# Date: 09-03-2022
# Load libraries needed ---------------------------
library(dplyr)
# Set working directory ---------------------------
setwd("/cloud/project/Lab 6")
# Load data ---------------------------
ShrubData <- read.csv("shrub-volume-data.csv")
#hand in q1
select(ShrubData, experiment, site)
#hand in q2
mutate(ShrubData, length*width)
#hand in q3
arrange(ShrubData,width)
#hand in q4
arrange(ShrubData, length)
#hand in q5
filter(ShrubData, height > 5)
#hand in q6
filter(ShrubData, height > 4, width > 2)
#hand in q7
filter(ShrubData, site ==1|site ==2)
#hand in q8
filter(ShrubData, ! is.na(width))
#Part 2.2
# Load data
maxtemp <-read.csv("max-temperature.csv")
filter(maxtemp, !is.na(Max.Temp.C))
#hand in q9
## Maximum monthly temperature
filterdata <- filter(maxtemp, !is.na(Max.Temp.C))
pf3

Partial preview of the text

Download chem 1050 study guide and more Summaries Chemistry in PDF only on Docsity!

Title: My R script for lab 6

Author: Abby Brothers

Date: 09-03-

Load libraries needed ---------------------------

library(dplyr)

Set working directory ---------------------------

setwd("/cloud/project/Lab 6")

Load data ---------------------------

ShrubData <- read.csv("shrub-volume-data.csv") #hand in q select(ShrubData, experiment, site) #hand in q mutate(ShrubData, length*width) #hand in q arrange(ShrubData,width) #hand in q arrange(ShrubData, length) #hand in q filter(ShrubData, height > 5) #hand in q filter(ShrubData, height > 4, width > 2) #hand in q filter(ShrubData, site ==1|site ==2) #hand in q filter(ShrubData,! is.na(width)) #Part 2.

Load data

maxtemp <-read.csv("max-temperature.csv") filter(maxtemp, !is.na(Max.Temp.C)) #hand in q

Maximum monthly temperature

filterdata <- filter(maxtemp, !is.na(Max.Temp.C))

by_month <- group_by(filterdata,Month) data2 <- summarize (by_month,mean(Max.Temp.C)) print(data2) #part 2.

Bird Banding

#load data number_of_birds <- c(28, 32, 1, 0, 10, 22, 30, 19, 145, 27, 36, 25, 9, 38, 21, 12, 122, 87, 36, 3, 0, 5, 55, 62, 98, 32, 900, 33, 14, 39, 56, 81, 29, 38, 1, 0, 143, 37, 98, 77, 92, 83, 34, 98, 40, 45, 51, 17, 22, 37, 48, 38, 91, 73, 54, 46, 102, 273, 600, 10, 11)

hand in q

length(number_of_birds)

the number of sites is 61

hand in q

sum(number_of_birds)

total number of birds is 4366

#hand in q min(number_of_birds)

minimum number of birds is 0

#hand in q max(number_of_birds)

maximum number of birds is 900

#hand in q number_of_birds[61]

the number of birds at the last site is 11

hand in q

number_of_birds[42]

there are 83 birds at site 42

#hand in q surveys <- read.csv("surveys.csv") #hand in q survey_new <-filter(surveys, !is.na(weight)) #hand in q survey_new_2 <- select(survey_new,year,month,day,species_id,weight)