Running examples in 'agriTutorial-Ex.R' failed
The error most likely occurred in:

> ### Name: example4
> ### Title: Example 4: One qualitative treatment factor with repeated
> ###   measurements over time.
> ### Aliases: example4
> 
> ### ** Examples
> 
> 
> ## *************************************************************************************
> ##                       How to run the code
> ## *************************************************************************************
> 
> ## Either type example("example4") to run ALL the examples succesively
> ## or copy and paste examples sucessively, as required
> 
> ## *************************************************************************************
> ##                          Options and required packages
> ## *************************************************************************************
> 
> options(contrasts = c('contr.treatment','contr.poly'))
> require(nlme)
Loading required package: nlme
> 
> ## *************************************************************************************
> ##            Section 1:  Polynomials for weeks and blocks contrasts
> ## *************************************************************************************
> 
> sorghum$rawWeeks = poly(sorghum$varweek, degree = 4, raw = TRUE)
> sorghum$polWeeks = poly(sorghum$varweek, degree = 4, raw = FALSE)
> sorghum$polBlocks = poly(sorghum$varblock, degree = 4, raw = FALSE)
> sorghum$factblock = factor(sorghum$varblock)
> 
> ## *************************************************************************************
> ## Section 2: Various correlation models assuming full factorial blocks and weeks model
> ## *************************************************************************************
> 
> AIC = NULL
> logLik = NULL
> Model = c("ID", "CS", "AR(1)", "AR(1) + nugget", "UN")
> 
> ## independent uncorrelated random plots
> full_indy = gls(y ~ factweek * (Replicate + variety), sorghum)
> anova(full_indy)
Denom. DF: 60 
                   numDF  F-value p-value
(Intercept)            1 80947.08  <.0001
factweek               4   220.90  <.0001
Replicate              4   358.86  <.0001
variety                3   334.87  <.0001
factweek:Replicate    16     1.82  0.0495
factweek:variety      12     4.48  <.0001
> AIC = c(AIC, AIC(full_indy))
Error in ll(object) : could not find function "ll"
Calls: AIC -> AIC.default
Execution halted