Error

Error: 'newSpatialExperiment' is not an exported object from 'namespace:SpatialExperiment'spatial_exp <- SpatialExperiment::newSpatialExperiment(assays = list("counts" = as(exp_matrix, "dgCMatrix")))

Solution

Make sure the SpatialExperiment package is installed correctly and try to reinstall; Or, use the library(SpatialExperiment) or require(SpatialExperiment) statement to load the package.