add Yiwen's R code