accumulation curve for student

การหาจำนวนแปลงที่เหมาะสมสำหรับใช้ในการสำรวจความหลากหลายทางชนิด

1. นำเข้าข้อมูลได้ 2 วิธี

วิธีที่ 1: นำเข้าด้วยการพิมพ์ใน R โดยตรง

ขั้นที่ 1.1 กรอกข้อมูลตามที่ได้จากการสุ่มตัวอย่างมาเข้าไปในโปรแกรม R โดยใช้คำสั่ง data.frame

df <- data.frame(
  Plot1 = c(10, 5, 0, 1, 7),
  Plot2 = c(7, 2, 1, 4, 3),
  Plot3 = c(0, 6, 9, 2, 8),
  Plot4 = c(3, 1, 0, 6, 2),
  Plot5 = c(2, 4, 7, 1, 3)
)
df
  Plot1 Plot2 Plot3 Plot4 Plot5
1    10     7     0     3     2
2     5     2     6     1     4
3     0     1     9     0     7
4     1     4     2     6     1
5     7     3     8     2     3

ขั้นที่ 1.2 ปรับตารางข้อมูลสลับแนวตั้งแนวนอนเพื่อให้อยู่ในรูปแบบที่พร้อมใช้งานโดยใช้คำสั่ง t

df1 <- t(df)
df1
      [,1] [,2] [,3] [,4] [,5]
Plot1   10    5    0    1    7
Plot2    7    2    1    4    3
Plot3    0    6    9    2    8
Plot4    3    1    0    6    2
Plot5    2    4    7    1    3

วิธีที่ 2: นำเข้าจากไฟล์ .csv ที่เตรียมไว้ใน excel

ขั้นที่ 2.1 นำเข้าข้อมูลจากไฟล์ csv โดยใช้คำสั่ง read.csv

df<-read.csv("G:\\My Drive\\document for each subject\\1st semester\\931402_Biodiversity\\67\\Lab01\\sp_data.csv")
df
      X V1 V2 V3 V4 V5
1 Plot1 10  5  0  1  7
2 Plot2  7  2  1  4  3
3 Plot3  0  6  9  2  8
4 Plot4  3  1  0  6  2
5 Plot5  2  4  7  1  3

ขั้นที่ 2.1 เตรียมข้อมูลให้พร้อมใช้โดยการตัด column ที่เป็นชื่อแปลงออกจากข้อมูล โดยการสั่งให้เลือกใช้ข้อมูลตั้งแต่ column ที่ 2 เป็นต้นไป

df2<-df[,2:ncol(df)]
df2
  V1 V2 V3 V4 V5
1 10  5  0  1  7
2  7  2  1  4  3
3  0  6  9  2  8
4  3  1  0  6  2
5  2  4  7  1  3

2. เปิดใช้งาน package ที่ชื่อ vegan ซึ่งเป็น package ที่สร้างขึ้นมาสำหรับการวิเคราะห์ข้อมูลความหลากหลายทางชนิด

library(vegan)
Warning: package 'vegan' was built under R version 4.4.2
Loading required package: permute
Loading required package: lattice
This is vegan 2.6-8

3. คำนวณหาเส้นโค้งจำนวนชนิดสะสมที่ได้จากข้อมูลของแปลงที่ใช้สุ่มตัวอย่าง พร้อมทั้งคำนวณค่า SD เพื่อใช้ระบุจำนวนแปลงที่เหมาะสมเมื่อค่า SD = 0

โดยใช้คำสั่ง specaccum (เลือกใช้ข้อมูลจาก df1 หรือ df2 ขึ้นกับวิธีการนำเข้าข้อมูล)

spec_accum <- specaccum(df2)
Warning in cor(x > 0): the standard deviation is zero
spec_accum
Species Accumulation Curve
Accumulation method: exact
Call: specaccum(comm = df2) 

                           
Sites    1.000000 2.0 3 4 5
Richness 4.400000 4.9 5 5 5
sd       0.489898 0.3 0 0 0

4. สร้างกราฟแสดงจำนวนแปลงที่เหมาะสมโดยใช้คำสั่ง plot

plot(spec_accum, col="blue", ci.type = "poly", ci.col = "light blue", ci.lty = 0, ylab = "Species accumulation", main = "Species Accumulation Curve")

สรุปได้ว่าจำนวนแปลงที่เหมาะสมสำหรับชุดข้อมูลนี้คือตั้งแต่ 3 แปลงเป็นต้นไป