Load Data from Webpage

Nothing to show here … this is the same as what we did in the previous class example.

> firedf <- read.csv("Fire.csv")
> str(firedf)
'data.frame':   48 obs. of  6 variables:
 $ sttype: chr  "d" "d" "d" "d" ...
 $ tslf  : chr  "0-100" "0-100" "0-100" "0-100" ...
 $ tdw   : num  27.7 22.6 26.2 43.6 27 41.2 46.6 27.6 89.2 39.6 ...
 $ litdep: num  0.62 1.33 1.46 1.92 2.9 2.13 2.33 1.46 2.25 3.08 ...
 $ fuel1h: num  0.06 0.07 0.08 0.05 0.06 0.15 0.02 0.04 0.04 0.3 ...
 $ tltd  : int  2382 1978 1234 1478 1901 1111 748 1055 3422 1045 ...


Examining Single Variable

  1. The stand type variable is shown below with firedf$sttype.
  2. The litter depth variable is shown below with firedf$litdep.

R Code and Results

> firedf$sttype
 [1] "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d"  "d" 
[18] "d"  "d"  "d"  "d"  "d"  "d"  "d"  "md" "md" "md" "md" "md" "md" "md" "md" "md" "md"
[35] "md" "md" "md" "mc" "mc" "mc" "mc" "c"  "c"  "c"  "c"  "c"  "c"  "c" 
> firedf$litdep
 [1] 0.62 1.33 1.46 1.92 2.90 2.13 2.33 1.46 2.25 3.08 2.07 1.83 2.63 2.58 2.38 2.75 2.92
[18] 2.46 1.96 1.63 2.13 2.71 3.08 2.42 1.75 2.75 2.00 1.25 2.38 2.08 3.13 2.38 3.00 2.29
[35] 1.90 2.71 1.83 2.04 2.90 3.13 2.00 2.08 2.92 0.75 1.75 2.08 2.38 2.13


Filtering Data Frames

  1. There are 24 of deciduous stand types (see decid object below).
  2. There are 14 of stand with litter depths less than 2 cm (see lt2 object below).
  3. There are 11 of coniferous and mixed-coniferous stand types (see cmc object below).
  4. There are two of coniferous stand types with litter depths of less than 2 cm (see clt2 object below).
  5. There are four of stands with between 1 and 1.5 cm litter depths (see btw115 object below).

R Code and R Results

> decid <- filterD(firedf,sttype=="d")
> str(decid)
'data.frame':   24 obs. of  6 variables:
 $ sttype: chr  "d" "d" "d" "d" ...
 $ tslf  : chr  "0-100" "0-100" "0-100" "0-100" ...
 $ tdw   : num  27.7 22.6 26.2 43.6 27 41.2 46.6 27.6 89.2 39.6 ...
 $ litdep: num  0.62 1.33 1.46 1.92 2.9 2.13 2.33 1.46 2.25 3.08 ...
 $ fuel1h: num  0.06 0.07 0.08 0.05 0.06 0.15 0.02 0.04 0.04 0.3 ...
 $ tltd  : int  2382 1978 1234 1478 1901 1111 748 1055 3422 1045 ...
> lt2 <- filterD(firedf,litdep<2)
> str(lt2)
'data.frame':   14 obs. of  6 variables:
 $ sttype: chr  "d" "d" "d" "d" ...
 $ tslf  : chr  "0-100" "0-100" "0-100" "0-100" ...
 $ tdw   : num  27.7 22.6 26.2 43.6 27.6 29.8 64.9 31.4 26 35.4 ...
 $ litdep: num  0.62 1.33 1.46 1.92 1.46 1.83 1.96 1.63 1.75 1.25 ...
 $ fuel1h: num  0.06 0.07 0.08 0.05 0.04 0.1 0.2 0.06 0.07 0.09 ...
 $ tltd  : int  2382 1978 1234 1478 1055 1205 753 632 1581 1072 ...
> cmc <- filterD(firedf,sttype %in% c("c","mc"))
> str(cmc)
'data.frame':   11 obs. of  6 variables:
 $ sttype: chr  "mc" "mc" "mc" "mc" ...
 $ tslf  : chr  "200-300" "100-200" "200-300" "100-200" ...
 $ tdw   : num  103.4 69.8 47.2 35.6 42 ...
 $ litdep: num  2.04 2.9 3.13 2 2.08 2.92 0.75 1.75 2.08 2.38 ...
 $ fuel1h: num  0.05 0.31 0.37 0.03 0.22 0.56 0.16 0.67 0.12 0.55 ...
 $ tltd  : int  775 1065 820 1650 578 999 961 437 1136 1288 ...
> clt2 <- filterD(firedf,sttype=="c",litdep<2)
> str(clt2)
'data.frame':   2 obs. of  6 variables:
 $ sttype: chr  "c" "c"
 $ tslf  : chr  "200-300" "200-300"
 $ tdw   : num  34.9 26.8
 $ litdep: num  0.75 1.75
 $ fuel1h: num  0.16 0.67
 $ tltd  : int  961 437
> btw115 <- filterD(firedf,litdep>1,litdep<1.5)
> str(btw115)
'data.frame':   4 obs. of  6 variables:
 $ sttype: chr  "d" "d" "d" "md"
 $ tslf  : chr  "0-100" "0-100" "0-100" "0-100"
 $ tdw   : num  22.6 26.2 27.6 35.4
 $ litdep: num  1.33 1.46 1.46 1.25
 $ fuel1h: num  0.07 0.08 0.04 0.09
 $ tltd  : int  1978 1234 1055 1072