reimplement fpc sumstats in R