Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': object 'Classes' not found

Classess<-read.csv("SEEA_Classes.csv")
landcover2005<-raster("clip 2005_2005.tif")
r.list <- list.files(getwd(), "tif$")
LandCoverClasses<-c("Artificialsurface","Herbaceouscrops","Woodyarea","Multipleorlayeredcrop", "Grassland","Treecoveredareas","Mangrove",
"Shrubcoverareas","Shrubsandorherbaceousareas", "Sparselynaturalvegetatedareas","Terrestrialbarrenland","PermanentsnowandGlacier","Inlandwaterbodies")
colours<-c("#ff1400","#ffb24a","#629448","#ff9011","#93cf2c","#018f33","#94ba96","#966400","#00dc82",
"#ffebaf","#bfbfbf","#ffffff","#b3c3e4")
SEEAMAT<-as.matrix( Classes,ncol = 3,byrow = TRUE)
LandMatrix<-function(SEEAClasses ,FirstYear,ListFiles, SEEAcolores,legendclasses)
{
SEEAMAT<-as.matrix( SEEAClasses ,ncol = 3,byrow = TRUE)
year2005Reclass<-reclassify(FirstYear,SEEAMAT)
for( i in ListFiles){
r <- raster(i)
landcoverreclass<-reclassify(r,SEEAMAT)
v<-data.frame(year2005Reclass=values(year2005Reclass),landcoverreclass=values(landcoverreclass))
n<-table(v)
m<-(round(addmargins(n)3003001/1000000,digits = 1))
row.names(m)[row.names(m)=="1"]<-"Artificialsurface"
row.names(m)[row.names(m)=="2"]<-"Herbaceouscrops"
row.names(m)[row.names(m)=="3"]<-"Woodyarea"
row.names(m)[row.names(m)=="4"]<-"Multipleorlayeredcrop"
row.names(m)[row.names(m)=="5"]<-"Grassland"
row.names(m)[row.names(m)=="6"]<-"Treecoveredareas"
row.names(m)[row.names(m)=="7"]<-"Mangrove"
row.names(m)[row.names(m)=="8"]<-"Shrubcoverareas"
row.names(m)[row.names(m)=="9"]<-"Shrubsandorherbaceousareas"
row.names(m)[row.names(m)=="10"]<-"Sparselynaturalvegetatedareas"
row.names(m)[row.names(m)=="11"]<-"Terrestrialbarrenland"
row.names(m)[row.names(m)=="12"]<-"Permanentsnowandglacier"
row.names(m)[row.names(m)=="13"]<-"Inlandwaterbodies"
row.names(m)[row.names(m)=="14"]<-"Ocean"
colnames(m)[colnames(m)=="1"]<-"Artificialsurface"
colnames(m)[colnames(m)=="2"]<-"Herbaceouscrops"
colnames(m)[colnames(m)=="3"]<-"Woodyarea"
colnames(m)[colnames(m)=="4"]<-" Multipleorlayeredcrop"
colnames(m)[colnames(m)=="5"]<-"Grassland"
colnames(m)[colnames(m)=="6"]<-"Treecoveredareas"
colnames(m)[colnames(m)=="7"]<-"Mangrove"
colnames(m)[colnames(m)=="8"]<-"Shrubcoverareas"
colnames(m)[colnames(m)=="9"]<-"Shrubsandorherbaceousareas"
colnames(m)[colnames(m)=="10"]<-"Sparselynaturalvegetatedareas"
colnames(m)[colnames(m)=="11"]<-"Terrestrialbarrenland"
colnames(m)[colnames(m)=="12"]<-"Permanentsnowandglacier"
colnames(m)[colnames(m)=="13"]<-"Inlandwaterbodies"
colnames(m)[colnames(m)=="14"]<-"Ocean"
c<-c("Land Cover Change")
d<-c(substr(i,start = 37,stop = 40))
n<-paste(c,d,sep = "")
write.table(n,file="matrix.csv",append=TRUE,sep=",",col.names=NA,row.names=TRUE,quote=FALSE)
write.table(m,file="matrix.csv",append=TRUE,sep=",",col.names=NA,row.names=TRUE,quote=FALSE)
a<-c("percentage")
b<-c(substr(i,start = 37,stop = 40))
d<-paste(b,a,sep ="")
Year2005<-cbind(rowSums(round(table(v)300300
1/1000000,digits = 1)))
OtherYears<-cbind(colSums(round(table(v)300300*1/1000000,digits = 1)))
Year2005percentage<-cbind(round((Year2005/sum(Year2005)*100),digits = 1))
OtherYearspercentage<-cbind(round((OtherYears/sum(OtherYears)*100),digits = 1))
Difference<-cbind(c(OtherYears)-c(Year2005))
percentageDifference<-(Difference/Year2005)*100
FinalTable_A<-cbind(c(Year2005),c(OtherYears),c(Difference),c(Year2005percentage),c(OtherYearspercentage),c(percentageDifference))
FinalTable_B<-as.matrix(FinalTable_A)
FinalTable<-as.data.frame(FinalTable_B)
row.names(FinalTable)[row.names(FinalTable)=="1"]<-"Artificialsurface"
row.names(FinalTable)[row.names(FinalTable)=="2"]<-"Herbaceouscrops"
row.names(FinalTable)[row.names(FinalTable)=="3"]<-"Woodyarea"
row.names(FinalTable)[row.names(FinalTable)=="4"]<-"Multipleorlayeredcrop"
row.names(FinalTable)[row.names(FinalTable)=="5"]<-"Grassland"
row.names(FinalTable)[row.names(FinalTable)=="6"]<-"Treecoveredareas"
row.names(FinalTable)[row.names(FinalTable)=="7"]<-"Mangrove"
row.names(FinalTable)[row.names(FinalTable)=="8"]<-"Shrubcoverareas"
row.names(FinalTable)[row.names(FinalTable)=="9"]<-"Shrubsandorherbaceousareas"
row.names(FinalTable)[row.names(FinalTable)=="10"]<-"Sparselynaturalvegetatedareas"
row.names(FinalTable)[row.names(FinalTable)=="11"]<-"Terrestrialbarrenland"
row.names(FinalTable)[row.names(FinalTable)=="12"]<-"Permanentsnowandglacier"
row.names(FinalTable)[row.names(FinalTable)=="13"]<-"Inlandwaterbodies"
row.names(FinalTable)[row.names(FinalTable)=="14"]<-"Ocean"
colnames(FinalTable)<-c("2000",substr(i,start = 37,stop = 40),"Difference","2000Percentage",d,"percentageDifference")

write.table(FinalTable,file="Change.csv",append=TRUE,sep=",",col.names=NA,row.names=TRUE,quote = FALSE)
file_name = paste("landCover", i, ".png", sep="")
map1=tm_shape(landcoverreclass)+
  tm_raster(style = "cat",
            labels = c("ArtificialSurface","HerbaceousCrops","WoodyCrops","MultiplelayredCrops","Grassland","TreecoveredAreas","Mangroves","Shrubcovered areas","Shrubsandorherbaceousareas","SparselyNaturalVegetated areas","TerrestrialBarrenLand","PermanentSnowAndGlaciers","InlandwaterBodies"), palette =c("#ff1400" , "#ffb24a" , "#629448" ,"#ff9011" ,"#93cf2c" , "#018f33" ,"#94ba96" ,"#966400" ,"#00dc82" , "#ffebaf" ,"#bfbfbf" ,"#ffffff" ,"#b3c3e4"),
            title = "LandCover")+ tm_layout(main.title = "Land Cover Change",title.size = 1.5,title.position = c("right","top"))+
  tm_compass(position = c("left","bottom"))+
  tm_scale_bar(position = c("left","bottom"))+tm_layout(main.title = substr(i,start = 37,stop = 40),title.size = 1.5,title.position = c("right","top"))+tm_layout(legend.outside = TRUE)
tmap_save(map1,file_name,height=8.5, width=11, units="in", dpi=300)

}
}

LandCoverChangeMatrices<-LandMatrix(SEEAClasses = Classes,FirstYear=landcover2005,ListFiles = r.list,SEEAcolores=colours,legendclasses=LandCoverClasses)

Query solved thanks!!