Spatial Panel Data Analysis using SPLM

Hello. I am working on a SpatialPolygonsDataFrame (composed of a spatial panel dataset from 2003-2023 [dimension 470]) and a shapefile of 47 regions ([dimension 47]). How do I create a weights matrix that takes to account these panels to assure congruence of the length for spatial panel analysis using SPLM