Error in as.vector (y) but the same codes work on a different computer

This seems like a development version, try installing a stable version from CRAN.

If this doesn't work, please try to provide a proper REPRoducible EXample (reprex) illustrating your issue.