使用R安装外源包时发现报错:‘for’ loop initial declarations are only allowed in C99 mode:
这是因为gcc基于c89标准,换成C99标准就可以了,使用withr包可以指定使用的gcc标准:
library(withr)
with_makevars(c(PKG_CFLAGS = "-std=c11"),
install.packages('seriation'), # my installation code
assignment = "+=")
参考
https://stackoverflow.com/questions/35198301/how-use-the-option-std-c99-for-installing-r-packages