Running examples in ‘SpATS-Ex.R’ failed
The error most likely occurred in:

> ### Name: SpATS
> ### Title: Spatial analysis of field trials with splines
> ### Aliases: SpATS
> 
> ### ** Examples
> 
> library(SpATS)
> data(wheatdata)
> summary(wheatdata)
     yield            geno     rep          row            col     rowcode
 Min.   :194.0   82     :  6   1:110   Min.   : 1.0   Min.   : 1   1:105  
 1st Qu.:469.0   89     :  6   2:110   1st Qu.: 6.0   1st Qu.: 4   2:225  
 Median :617.5   104    :  6   3:110   Median :11.5   Median : 8          
 Mean   :591.8   1      :  3           Mean   :11.5   Mean   : 8          
 3rd Qu.:713.5   2      :  3           3rd Qu.:17.0   3rd Qu.:12          
 Max.   :925.0   3      :  3           Max.   :22.0   Max.   :15          
                 (Other):303                                              
 colcode
 1:88   
 2:88   
 3:88   
 4:66   
        
        
        
> 
> # Create factor variable for row and columns
> wheatdata$R <- as.factor(wheatdata$row)
> wheatdata$C <- as.factor(wheatdata$col)
> 
> m0 <- SpATS(response = "yield", spatial = ~ SAP(col, row, nseg = c(10,20), degree = 3, pord = 2), 
+  genotype = "geno", fixed = ~ colcode + rowcode, random = ~ R + C, data = wheatdata, 
+  control =  list(tolerance = 1e-03))
Effective dimensions
-------------------------
It.     Deviance           R           Cf(col,row)|colf(col,row)|row
  1 686384.843128       1.196       0.962      11.769      15.563
  2  2107.446777       1.234       3.922      12.391      15.060
  3  2079.185180       1.722       6.767      11.306      13.853
  4  2072.650074       2.628       7.316      10.554      12.547
  5  2069.709184       3.827       7.264      10.199      11.474
  6  2067.893125       5.141       7.153      10.046      10.721
  7  2066.842352       6.330       7.061       9.992      10.215
  8  2066.299268       7.234       6.989       9.987       9.886
  9  2066.044505       7.834       6.933      10.006       9.678
 10  2065.929488       8.199       6.889      10.035       9.552
 11  2065.876579       8.411       6.855      10.066       9.477
 12  2065.851059       8.531       6.829      10.095       9.435
 13  2065.838130       8.600       6.809      10.120       9.411
 14  2065.831319       8.639       6.793      10.142       9.400
 15  2065.827632       8.663       6.782      10.160       9.395
 16  2065.825598       8.678       6.773      10.175       9.393
 17  2065.824460       8.688       6.766      10.187       9.394
 18  2065.823818       8.694       6.761      10.196       9.396
Timings:
SpATS 0.511 seconds
All process 0.576 seconds
> # Brief summary
> m0

Spatial analysis of trials with splines 

Response:                   yield     
Genotypes (as fixed):       geno      
Spatial:                    ~SAP(col, row, nseg = c(10, 20), degree = 3, pord = 2)
Fixed:                      ~colcode + rowcode
Random:                     ~R + C    


Number of observations:        330
Number of missing data:        0
Effective dimension:           149.05
Deviance:                      2065.824
> # More information: dimensions
> summary(m0) # summary(fit.m2, which = "dimensions") 

Spatial analysis of trials with splines 

Response:                   yield     
Genotypes (as fixed):       geno      
Spatial:                    ~SAP(col, row, nseg = c(10, 20), degree = 3, pord = 2)
Fixed:                      ~colcode + rowcode
Random:                     ~R + C    


Number of observations:        330
Number of missing data:        0
Effective dimension:           149.05
Deviance:                      2065.824

Dimensions:
                      Effective     Model     Nominal     Ratio     Type
geno                      106.0       106         106      1.00        F
Intercept                   1.0         1           1      1.00        F
colcode                     3.0         3           3      1.00        F
rowcode                     1.0         1           1      1.00        F
R                           8.7        22          19      0.46        R
C                           6.8        15          10      0.68        R
col                         1.0         1           1      1.00        S
row                         1.0         1           1      1.00        S
rowcol                      1.0         1           1      1.00        S
f(col,row)|col             10.2        NA          NA        NA        S
f(col,row)|row              9.4        NA          NA        NA        S
f(col,row) Global          19.6       295         295      0.07        S
                                                                        
Total                     149.0       446         438      0.34         
Residual                  181.0                                         
Nobs                        330                                         

Type codes: F 'Fixed'    R 'Random'    S 'Smooth/Semiparametric'

> # More information: variances
> summary(m0, which = "variances") 

Spatial analysis of trials with splines 

Response:                   yield     
Genotypes (as fixed):       geno      
Spatial:                    ~SAP(col, row, nseg = c(10, 20), degree = 3, pord = 2)
Fixed:                      ~colcode + rowcode
Random:                     ~R + C    


Number of observations:        330
Number of missing data:        0
Effective dimension:           149.05
Deviance:                      2065.824

Variance components:
                    Variance            SD     log10(lambda)
R                  2.031e+02     1.425e+01           0.98084
C                  1.698e+03     4.121e+01           0.05846
f(col,row)|col     4.360e+04     2.088e+02          -1.35096
f(col,row)|row     6.404e+01     8.003e+00           1.48205
                                                            
Residual           1.943e+03     4.408e+01                  
> # More information: all
> summary(m0, which = "all") 

Spatial analysis of trials with splines 

Response:                   yield     
Genotypes (as fixed):       geno      
Spatial:                    ~SAP(col, row, nseg = c(10, 20), degree = 3, pord = 2)
Fixed:                      ~colcode + rowcode
Random:                     ~R + C    


Number of observations:        330
Number of missing data:        0
Effective dimension:           149.05
Deviance:                      2065.824

Variance components:
                    Variance            SD     log10(lambda)
R                  2.031e+02     1.425e+01           0.98084
C                  1.698e+03     4.121e+01           0.05846
f(col,row)|col     4.360e+04     2.088e+02          -1.35096
f(col,row)|row     6.404e+01     8.003e+00           1.48205
                                                            
Residual           1.943e+03     4.408e+01                  

Dimensions:
                      Effective     Model     Nominal     Ratio     Type
geno                      106.0       106         106      1.00        F
Intercept                   1.0         1           1      1.00        F
colcode                     3.0         3           3      1.00        F
rowcode                     1.0         1           1      1.00        F
R                           8.7        22          19      0.46        R
C                           6.8        15          10      0.68        R
col                         1.0         1           1      1.00        S
row                         1.0         1           1      1.00        S
rowcol                      1.0         1           1      1.00        S
f(col,row)|col             10.2        NA          NA        NA        S
f(col,row)|row              9.4        NA          NA        NA        S
f(col,row) Global          19.6       295         295      0.07        S
                                                                        
Total                     149.0       446         438      0.34         
Residual                  181.0                                         
Nobs                        330                                         

Type codes: F 'Fixed'    R 'Random'    S 'Smooth/Semiparametric'

> 
> # Plot results
> plot(m0)
> plot(m0, all.in.one = FALSE)
Press return for next page....
Press return for next page....
Press return for next page....
Press return for next page....
Press return for next page....
> 
> # Variogram
> var.m0 <- variogram(m0)
> plot(var.m0)
tcltk DLL is linked to '/opt/R/arm64/lib/libtk8.6.dylib'
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Tcl/Tk libraries are missing: install the Tcl/Tk component from the R installer
Execution halted