Install the PRECAST

This vignette provides an introduction to the R package PRECAST, where the function PRECAST implements the model PRECAST, a PRobabilistic Embedding and Clustering with alignment for Spatial Transcriptomics data integration . The package can be installed with the following command from Github:

install.packages('remotes') remotes::install_github("feiyoung/PRECAST")

or install from CRAN


The package can be loaded with the command:

#> Loading required package: parallel
#> Loading required package: gtools
#> PRECAST :  An efficient data integration method is provided for multiple spatial transcriptomics data with non-cluster-relevant effects such as the complex batch effects. It unifies spatial factor analysis simultaneously with spatial clustering and embedding alignment, requiring only partially shared cell/domain clusters across datasets. More details can be referred to Wei Liu, et al. (2023) <doi:10.1038/s41467-023-35947-w>.   Check out our Package website ( for a more complete description of the methods and analyses

Setup on Linux or MacOS system

For running big data, users can use the following system command to set the C_stack unlimited in case of R Error: C stack usage is too close to the limit.

ulimit -s unlimited