R version 2.11.1 (2010-05-31) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > Loading required package: vcd Loading required package: MASS Loading required package: grid Loading required package: colorspace Loading required package: splines Loading required package: reshape Loading required package: plyr Loading required package: languageR Loading required package: lattice Loading required package: zipfR Loading required package: Matrix Attaching package: 'Matrix' The following object(s) are masked from 'package:reshape': expand The following object(s) are masked from 'package:base': det Loading required package: lme4 Loading required package: ggplot2 Loading required package: proto Loading required package: digest Loading required package: amap Loading required package: HSAUR2 Loading required package: scatterplot3d Loading required package: JGR Loading required package: rJava Loading required package: JavaGD Loading required package: iplots starting httpd help server ... done > library(DAAG) Loading required package: rpart Loading required package: randomForest randomForest 4.5-34 Type rfNews() to see new features/changes/bug fixes. Attaching package: 'DAAG' The following object(s) are masked from 'package:plyr': ozone The following object(s) are masked from 'package:MASS': hills > data(rainforest) > names(rainforest) [1] "dbh" "wood" "bark" "root" "rootsk" [6] "branch" "species" > rainforest dbh wood bark root rootsk branch species 27 6 NA NA 6 0.3 NA Acacia mabellae 61 23 353 NA 135 13.0 35 Acacia mabellae 62 20 208 NA NA NA 41 Acacia mabellae 63 23 445 NA NA NA 50 Acacia mabellae 65 24 590 NA NA NA NA Acacia mabellae 80 5 14 NA 2 2.4 NA Acacia mabellae 81 5 10 NA NA NA NA Acacia mabellae 82 8 31 NA NA NA NA Acacia mabellae 83 10 59 NA NA NA NA Acacia mabellae 84 8 30 NA 6 1.0 4 Acacia mabellae 95 22 320 NA 51 17.0 30 Acacia mabellae 96 9 20 NA 6 1.0 13 Acacia mabellae 97 10 29 NA NA NA 10 Acacia mabellae 98 10 35 NA 9 2.0 17 Acacia mabellae 99 19 203 NA 16 11.0 46 Acacia mabellae 100 35 1090 NA 66 24.0 92 Acacia mabellae 102 6 10 NA NA NA 11 C. fraseri 103 4 7 NA NA NA 6 C. fraseri 104 4 3 NA NA NA 5 C. fraseri 105 6 13 NA NA NA 5 C. fraseri 106 5 9 NA NA NA 8 C. fraseri 107 8 20 NA NA NA 9 C. fraseri 108 6 16 NA NA NA 6 C. fraseri 109 5 7 NA NA NA 8 C. fraseri 110 7 29 NA NA NA 14 C. fraseri 111 5 12 NA NA NA 8 C. fraseri 112 7 25 NA NA NA 16 C. fraseri 113 6 10 NA NA NA 9 C. fraseri 114 25 506 NA NA NA 45 Acmena smithii 115 24 508 NA NA NA 65 Acmena smithii 116 31 817 NA NA NA 95 Acmena smithii 117 21 274 NA NA NA 31 Acmena smithii 118 16 162 NA NA NA 25 Acmena smithii 119 27 540 NA NA NA 55 Acmena smithii 120 19 272 NA NA NA 52 Acmena smithii 121 21 293 NA NA NA NA Acmena smithii 122 10 77 NA NA NA NA Acmena smithii 123 23 408 NA NA NA NA Acmena smithii 124 27 550 105 44 9.0 59 B. myrtifolia 125 26 414 78 38 13.0 44 B. myrtifolia 126 9 42 8 5 1.3 7 B. myrtifolia 127 12 85 13 17 2.2 16 B. myrtifolia 128 9 35 NA NA NA 9 B. myrtifolia 129 11 60 NA NA NA 13 B. myrtifolia 130 10 60 NA NA NA 12 B. myrtifolia 131 37 1250 NA NA NA 76 B. myrtifolia 132 37 990 NA NA NA 90 B. myrtifolia 133 20 290 NA NA NA 36 B. myrtifolia 134 56 1500 NA NA NA NA B. myrtifolia 135 9 40 NA NA NA NA Acmena smithii 136 17 216 NA NA NA 40 Acmena smithii 137 17 208 NA NA NA NA Acmena smithii 138 10 50 NA NA NA NA Acmena smithii 139 6 18 NA NA NA NA Acmena smithii 140 22 382 NA NA NA NA Acmena smithii 141 15 161 NA NA NA NA Acmena smithii 142 15 140 NA NA NA NA Acmena smithii 143 19 280 NA NA NA NA Acmena smithii 144 11 84 NA NA NA NA Acmena smithii 145 9 50 NA NA NA NA Acmena smithii 146 25 510 NA NA NA 45 Acmena smithii 147 22 400 NA NA NA 35 Acmena smithii 148 10 70 NA NA NA NA Acmena smithii 149 12 115 NA NA NA NA Acmena smithii 150 48 1530 NA NA NA 120 Acmena smithii > summary(rainforest) dbh wood bark Min. : 4.00 Min. : 3.0 Min. : 8.00 1st Qu.: 8.00 1st Qu.: 29.0 1st Qu.: 11.75 Median :12.00 Median : 100.0 Median : 45.50 Mean :16.06 Mean : 265.4 Mean : 51.00 3rd Qu.:22.00 3rd Qu.: 386.5 3rd Qu.: 84.75 Max. :56.00 Max. :1530.0 Max. :105.00 NA's : 1.0 NA's : 61.00 root rootsk branch Min. : 2.00 Min. : 0.300 Min. : 4.00 1st Qu.: 6.00 1st Qu.: 1.300 1st Qu.: 9.00 Median : 16.00 Median : 2.400 Median : 25.00 Mean : 30.85 Mean : 7.477 Mean : 32.86 3rd Qu.: 44.00 3rd Qu.:13.000 3rd Qu.: 45.50 Max. :135.00 Max. :24.000 Max. :120.00 NA's : 52.00 NA's :52.000 NA's : 22.00 species Acacia mabellae:16 C. fraseri :12 Acmena smithii :26 B. myrtifolia :11 > str(rainforest) 'data.frame': 65 obs. of 7 variables: $ dbh : num 6 23 20 23 24 5 5 8 10 8 ... $ wood : num NA 353 208 445 590 14 10 31 59 30 ... $ bark : num NA NA NA NA NA NA NA NA NA NA ... $ root : num 6 135 NA NA NA 2 NA NA NA 6 ... $ rootsk : num 0.3 13 NA NA NA 2.4 NA NA NA 1 ... $ branch : num NA 35 41 50 NA NA NA NA NA 4 ... $ species: Factor w/ 4 levels "Acacia mabellae",..: 1 1 1 1 1 1 1 1 1 1 ... > ?rainforest > Making packages.html . done dim(rainforest)+ + 1 [1] 66 8 > dim(rainforest) [1] 65 7 > attach(rainforest) > hist(dbh) > cor(rainforest[,1:6]) dbh wood bark root rootsk branch dbh 1 NA NA NA NA NA wood NA 1 NA NA NA NA bark NA NA 1 NA NA NA root NA NA NA 1 NA NA rootsk NA NA NA NA 1 NA branch NA NA NA NA NA 1 > cor(rainforest[,1:6],use="pair") dbh wood bark root rootsk dbh 1.0000000 0.9620567 0.9786973 0.6903738 0.9258645 wood 0.9620567 1.0000000 0.9995858 0.5759636 0.8865360 bark 0.9786973 0.9995858 1.0000000 0.9695494 0.8638498 root 0.6903738 0.5759636 0.9695494 1.0000000 0.6850095 rootsk 0.9258645 0.8865360 0.8638498 0.6850095 1.0000000 branch 0.9556773 0.9494024 0.9935624 0.4793472 0.8589656 branch dbh 0.9556773 wood 0.9494024 bark 0.9935624 root 0.4793472 rootsk 0.8589656 branch 1.0000000 > library(vmv) > tablemissing(adult, sortby="both") Error in apply(x, 2, function(x) length(which(is.na(x)))) : object 'adult' not found > tablemissing(rainforest, sortby="both") bark root rootsk branch wood dbh species Total 4 0 0 0 1 1 1 1 32 5 0 0 0 0 1 1 1 20 2 0 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 4 3 0 1 1 0 1 1 1 1 6 0 1 1 0 0 1 1 1 Total 61 52 52 22 1 0 0 65 > dev.new() > hist(dbh) > dev.new() > hist(root) > dev.new() > hist(rootsk) > help.start() > apply(rainforest[,1:6],2,hist) $dbh $breaks [1] 0 5 10 15 20 25 30 35 40 45 50 55 60 $counts [1] 7 23 6 8 12 3 2 2 0 1 0 1 $intensities [1] 0.021538462 0.070769231 0.018461538 0.024615385 [5] 0.036923077 0.009230769 0.006153846 0.006153846 [9] 0.000000000 0.003076923 0.000000000 0.003076923 $density [1] 0.021538462 0.070769231 0.018461538 0.024615385 [5] 0.036923077 0.009230769 0.006153846 0.006153846 [9] 0.000000000 0.003076923 0.000000000 0.003076923 $mids [1] 2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5 42.5 47.5 52.5 [12] 57.5 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $wood $breaks [1] 0 200 400 600 800 1000 1200 1400 1600 $counts [1] 36 13 9 0 2 1 1 2 $intensities [1] 0.002812500 0.001015625 0.000703125 0.000000000 [5] 0.000156250 0.000078125 0.000078125 0.000156250 $density [1] 0.002812500 0.001015625 0.000703125 0.000000000 [5] 0.000156250 0.000078125 0.000078125 0.000156250 $mids [1] 100 300 500 700 900 1100 1300 1500 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $bark $breaks [1] 0 50 100 150 $counts [1] 2 1 1 $intensities [1] 0.010 0.005 0.005 $density [1] 0.010 0.005 0.005 $mids [1] 25 75 125 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $root $breaks [1] 0 20 40 60 80 100 120 140 $counts [1] 8 1 2 1 0 0 1 $intensities [1] 0.030769231 0.003846154 0.007692308 0.003846154 [5] 0.000000000 0.000000000 0.003846154 $density [1] 0.030769231 0.003846154 0.007692308 0.003846154 [5] 0.000000000 0.000000000 0.003846154 $mids [1] 10 30 50 70 90 110 130 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $rootsk $breaks [1] 0 5 10 15 20 25 $counts [1] 7 1 3 1 1 $intensities [1] 0.10769231 0.01538462 0.04615385 0.01538462 0.01538462 $density [1] 0.10769231 0.01538462 0.04615385 0.01538462 0.01538462 $mids [1] 2.5 7.5 12.5 17.5 22.5 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $branch $breaks [1] 0 20 40 60 80 100 120 $counts [1] 21 7 9 2 3 1 $intensities [1] 0.024418605 0.008139535 0.010465116 0.002325581 [5] 0.003488372 0.001162791 $density [1] 0.024418605 0.008139535 0.010465116 0.002325581 [5] 0.003488372 0.001162791 $mids [1] 10 30 50 70 90 110 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" > dev.new() > par(mfrow=c(3,2)) > apply(rainforest[,1:6],2,hist) $dbh $breaks [1] 0 5 10 15 20 25 30 35 40 45 50 55 60 $counts [1] 7 23 6 8 12 3 2 2 0 1 0 1 $intensities [1] 0.021538462 0.070769231 0.018461538 0.024615385 [5] 0.036923077 0.009230769 0.006153846 0.006153846 [9] 0.000000000 0.003076923 0.000000000 0.003076923 $density [1] 0.021538462 0.070769231 0.018461538 0.024615385 [5] 0.036923077 0.009230769 0.006153846 0.006153846 [9] 0.000000000 0.003076923 0.000000000 0.003076923 $mids [1] 2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5 42.5 47.5 52.5 [12] 57.5 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $wood $breaks [1] 0 200 400 600 800 1000 1200 1400 1600 $counts [1] 36 13 9 0 2 1 1 2 $intensities [1] 0.002812500 0.001015625 0.000703125 0.000000000 [5] 0.000156250 0.000078125 0.000078125 0.000156250 $density [1] 0.002812500 0.001015625 0.000703125 0.000000000 [5] 0.000156250 0.000078125 0.000078125 0.000156250 $mids [1] 100 300 500 700 900 1100 1300 1500 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $bark $breaks [1] 0 50 100 150 $counts [1] 2 1 1 $intensities [1] 0.010 0.005 0.005 $density [1] 0.010 0.005 0.005 $mids [1] 25 75 125 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $root $breaks [1] 0 20 40 60 80 100 120 140 $counts [1] 8 1 2 1 0 0 1 $intensities [1] 0.030769231 0.003846154 0.007692308 0.003846154 [5] 0.000000000 0.000000000 0.003846154 $density [1] 0.030769231 0.003846154 0.007692308 0.003846154 [5] 0.000000000 0.000000000 0.003846154 $mids [1] 10 30 50 70 90 110 130 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $rootsk $breaks [1] 0 5 10 15 20 25 $counts [1] 7 1 3 1 1 $intensities [1] 0.10769231 0.01538462 0.04615385 0.01538462 0.01538462 $density [1] 0.10769231 0.01538462 0.04615385 0.01538462 0.01538462 $mids [1] 2.5 7.5 12.5 17.5 22.5 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" $branch $breaks [1] 0 20 40 60 80 100 120 $counts [1] 21 7 9 2 3 1 $intensities [1] 0.024418605 0.008139535 0.010465116 0.002325581 [5] 0.003488372 0.001162791 $density [1] 0.024418605 0.008139535 0.010465116 0.002325581 [5] 0.003488372 0.001162791 $mids [1] 10 30 50 70 90 110 $xname [1] "newX[, i]" $equidist [1] TRUE attr(,"class") [1] "histogram" > hist(rainforest[,1:6]) Error in hist.default(rainforest[, 1:6]) : 'x' must be numeric > median(rainforest[,1:6]) structure(c("NULL", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 27 NULL 61 62 63 65 80 81 82 83 84 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 Warning message: In format.data.frame(x, digits = digits, na.encode = FALSE) : corrupt data frame: columns will be truncated or padded with NAs > mean(rainforest[,1:6]) dbh wood bark root rootsk branch 16.06154 NA NA NA NA NA > mean(rainforest[,1:6],na.rm=TRUE) dbh wood bark root rootsk 16.061538 265.390625 51.000000 30.846154 7.476923 branch 32.860465 > median(rainforest[,1:6],na.rm=TRUE) [1] 20.5 > barplot(table(species)) > dev.new() > barplot(table(species)) > dev.new() > plot(wood) > hist(wood) > dev.new() > stripchart(wood) > stripchart(wood,pch=19) > dev.new();tablemissing(rainforest, sortby="both") bark root rootsk branch wood dbh species Total 4 0 0 0 1 1 1 1 32 5 0 0 0 0 1 1 1 20 2 0 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 4 3 0 1 1 0 1 1 1 1 6 0 1 1 0 0 1 1 1 Total 61 52 52 22 1 0 0 65 > dev.new();tablemissing(rainforest, sortby="variable") dbh wood bark root rootsk branch species Total 1 1 1 1 1 1 1 1 4 2 1 1 0 1 1 1 1 7 3 1 1 0 1 1 0 1 1 4 1 1 0 0 0 1 1 32 5 1 1 0 0 0 0 1 20 6 1 0 0 1 1 0 1 1 Total 0 1 61 52 52 22 0 65 > dev.new() > splom(rainforest[,1:6]) > library(YaleToolkit) > gpairs(rainforest) > dev.new() > gpairs(rainforest,pch=19) Error in gpairs(rainforest, pch = 19) : unused argument(s) (pch = 19) > dev.new() > plot(dbh,wood,col="species",pch=19) Error in plot.xy(xy, type, ...) : invalid color name 'species' > plot(dbh,wood,col=species,pch=19) > dev.new();plot(dbh,wood,col=species,pch=19,log="xy") > ggplot(rainforest,aes(x=dbh,y=wood))+geom_point()+facet_grid(.~species) Warning message: Removed 1 rows containing missing values (geom_point). > ggplot(rainforest,aes(x=log(dbh),y=log(wood)))+geom_point()+facet_grid(.~species) Warning message: Removed 1 rows containing missing values (geom_point). > dev.new();plot(species,wood) > object.browser() >