-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChapter01final.R
executable file
·57 lines (37 loc) · 1.01 KB
/
Chapter01final.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#=======================================
# R code for Chapter 1 of "Bayesian GLMs in R for Ecology"
# by Mark Warren & Carl Smith
#=======================================
#Create an object 'a'
a <- 1
a
#Manipulate object
a + 1
#Another object
b <- a + 1
b
#Create vector 'freq'
freq <- c(40,99,31,35,0)
freq
class(freq)
#Create categorical vector 'species'
species <- c("pike", "roach", "chub", "perch", "asp")
species
class(species)
#Create a data frame from the vectors 'species' and 'freq'
spec_freq <- data.frame(species,freq)
# Confirm the object contains the values by typing:
spec_freq
# What type of object is 'spec_freq'?
class(spec_freq)
#Import blue tit data
cyan <- read.table(file = "cyanistes.txt",
header = TRUE, dec = ".")
#Install package "psych"
install.packages("psych")
#Load package "psych"
library(psych)
describe(cyan$depth, skew = FALSE)
# vars n mean sd min max range se
# X1 1 438 0.33 0.1 0.17 0.75 0.58 0
#======================================= END