Errors in running code in vignettes:
when running code in 'treecm.Rnw'

> library(treecm)

> data(stonePine1TreeData)

> print(stonePine1TreeData)
$fieldData
    azimuth dBase dTip length tipD height tilt toBePruned pathToTip     biomass
L1      275    73   41   10.2 2.50   0.00   80      FALSE      TRUE 1825.120033
L2      275    41   16    3.9 2.75  10.20   80      FALSE      TRUE  192.826834
B1      190    15    0     NA 7.95  10.10    0      FALSE     FALSE  123.160705
B2      200    22    0     NA 7.95  10.40    0      FALSE     FALSE  312.987817
B3      230    15    0     NA 7.95  10.40    0      FALSE     FALSE  123.160705
B4      200    18    0     NA 7.95  11.15    0      FALSE     FALSE  191.998003
B5      180     7    0     NA 7.95  11.30    0      FALSE     FALSE   19.249859
B6      150     6    0     NA 7.95  11.30    0      FALSE     FALSE   13.225032
B7      340    16    0     NA 7.95  11.30    0      FALSE     FALSE  144.121427
B8      220    13    0     NA 3.95  11.80    0      FALSE     FALSE   86.921601
B9      165    19    0     NA 7.95  11.80    0      FALSE     FALSE  219.017380
B10     280     8    0     NA 7.95  11.90    0      FALSE     FALSE   26.647181
B11     170     9    0     NA 3.95  11.90    0      FALSE     FALSE   35.499271
B12     265     8    0     NA 7.95  12.20    0      FALSE     FALSE   26.647181
B13      75     6    0     NA 3.95  12.20    0      FALSE     FALSE   13.225032
B14     180     6    0     NA 7.95  12.20    0      FALSE     FALSE   13.225032
B15     170     6    0     NA 7.95  12.60    0      FALSE     FALSE   13.225032
B16     120     5    0     NA 7.95  12.60    0      FALSE     FALSE    8.483444
B17      10    14    0     NA 3.95  13.00    0      FALSE     FALSE  104.112967
B18     180    13    0     NA 7.95  13.00    0      FALSE     FALSE   86.921601
B19     260    13    0     NA 7.95  13.20    0      FALSE     FALSE   86.921601
B20      75     6    0     NA 3.95  13.20    0      FALSE     FALSE   13.225032
B21      75    10    0     NA 3.95  13.75    0      FALSE     FALSE   45.882751
B22     215     7    0     NA 7.95  13.75    0      FALSE     FALSE   19.249859
B23     140     7    0     NA 7.95  13.75    0      FALSE     FALSE   19.249859
C       275    16    0    3.0 3.00  14.10   80      FALSE      TRUE  144.121427

$density
[1] 650

$allometryFUN
function (x, diameter) 
{
    a <- 0.16843
    b <- 2.43523
    powerEquation(a, b, as.real(x[diameter]))
}
<environment: namespace:treecm>

$branchesCM
[1] 1


> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> summary(CM)
Polar (angle/degrees, distance/m, height/m): 230 , 2.82 , 7.57 

> plot(vectors, main = "A stone pine centre of mass")

> plot(CM)

> plot(vectors, main = "A stone pine centre of mass", 
+     xlim = c(-8, 10), ylim = c(-12, 4))

> plot(CM)

> plotPolarSegment(210, 10.6, 140, 14.4)

> rows <- substr(row.names(stonePine1TreeData$fieldData), 
+     1, 1)

> component <- substr(row.names(stonePine1TreeData$fieldData), 
+     1, 1)

> stonePine1TreeData$fieldData <- within(stonePine1TreeData$fieldData, 
+     biomass[height > 12 & component != "L"] <- biomass[height > 
+         1 .... [TRUNCATED] 

> rm("rows")

> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> summary(CM)
Polar (angle/degrees, distance/m, height/m): 230 , 2.71 , 8.43 

> plot(vectors, main = "A stone pine centre of mass under 2x snow load", 
+     xlim = c(-8, 10), ylim = c(-12, 4))

> plot(CM)

> plotPolarSegment(210, 10.6, 140, 14.4)

> data(stonePine1TreeData)

> rows <- substr(row.names(stonePine1TreeData$fieldData), 
+     1, 1)

> stonePine1TreeData$fieldData <- within(stonePine1TreeData$fieldData, 
+     {
+         biomass[((azimuth >= 270 | azimuth < 90) & rows != "L")] <-  .... [TRUNCATED] 

> rm(rows)

> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> summary(CM)
Polar (angle/degrees, distance/m, height/m): 215 , 3.69 , 8.57 

> library(treecm)

> data(stonePine1TreeData)

> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> op <- par(mfrow = c(2, 1), mai = c(0.5, 0.5, 0.5, 
+     0.2))

> plot(vectors, main = "Centre of mass of a stone pine")

> plot(CM)

> component <- row.names(stonePine1TreeData$fieldData)

> stonePine1TreeData$fieldData$toBePruned[component %in% 
+     c("B2", "B4")] <- TRUE

> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> plot(vectors, main = "Centre of mass of a stone pine, B2 and B4 removed")

> plot(CM)

> par(op)

> rm(op)

> data(stonePine1TreeData)

> stonePine1TreeData$fieldData <- within(stonePine1TreeData$fieldData, 
+     length[3:25] <- c(7, 7, 7, 7, 7, 7, 4, 7, 7, 4, 7, 7, 4, 
+         7, 7 .... [TRUNCATED] 

> vectors <- treeVectors(stonePine1TreeData)

> SR <- treeSR(stonePine1TreeData, vectors)

> plot(SR, main = "Branches slenderness ratio", xaxt = "n", 
+     yaxt = "n", xlab = "", ylab = "")

> library(treecm)

> data(stonePine1TreeData)

> vectors <- treeVectors(stonePine1TreeData)

> CM <- centreOfMass(vectors)

> treeMoment <- buildTreeMomentObject(centreOfMassModulus(CM), 
+     treeTotalBiomass(stonePine1TreeData), centreOfMassAngle(CM))

> treeMoment <- calcMoment(treeMoment)

> mainStem <- logPathSelection(stonePine1TreeData)

> (plinth <- getPlinthForce(l.stem = 10, d = 40, logs = mainStem, 
+     treeMoment = getMoment(treeMoment), CM = CM))
$force
[1] 11842.77

$distanceOnGround
[1] 37.03226

$anchorAlongStem
[1] 10

$cableLength
[1] 40

$anchorHeight
[1] 9.848078

$azimuth
[1] 50


> plinth <- getPlinthForce(l.stem = 10, d = 15:50, logs = mainStem, 
+     treeMoment = getMoment(treeMoment), CM = CM)

> print(plinth$force)
 [1] 17170.94 16133.11 15378.09 14804.64 14354.82 13993.00 13696.03 13448.23
 [9] 13238.55 13059.03 12903.75 12768.23 12649.04 12543.47 12449.38 12365.05
[17] 12289.09 12220.34 12157.87 12100.87 12048.68 12000.73 11956.55 11915.73
[25] 11877.90 11842.77 11810.05 11779.53 11750.99 11724.25 11699.16 11675.56
[33] 11653.35 11632.39 11612.60 11593.87

> plinth <- getPlinthForce(l.stem = seq(9, 12, 0.5), 
+     d = 40, logs = mainStem, treeMoment = getMoment(treeMoment), 
+     CM = CM)

> print(plinth$force)
[1] 13014.34 12396.25 11842.77 11344.76 10894.78 10486.65 10115.24

> aR <- anchorRange(mainStem, CM)

> l.stemSeq <- round(seq(aR[["z"]] + 1, aR[["hMax"]] - 
+     2, length.out = 6), 2)

> plinth <- data.frame(getPlinthForce(l.stemSeq, 17:50, 
+     mainStem, getMoment(treeMoment), CM))

> head(plinth)
     force distanceOnGround anchorAlongStem cableLength anchorHeight azimuth
1 16391.09         13.26886            8.57          17     8.439802      50
2 15980.26         14.41057            8.57          18     8.439802      50
3 15647.68         15.53446            8.57          19     8.439802      50
4 15373.36         16.64384            8.57          20     8.439802      50
5 15143.56         17.74123            8.57          21     8.439802      50
6 14948.51         18.82857            8.57          22     8.439802      50

> library(ggplot2)

  When sourcing 'treecm.R':
Error: there is no package called 'ggplot2'
Execution halted

  'treecm.Rnw'... failed