[R] incomplete final line found warning

Xiaobo Gu guxiaobo1982 at gmail.com
Sun Dec 11 04:01:47 CET 2011


I saved the following as a UTF-8 encoded file named amberutil.r

as.factor.loop <- function(df, cols){

	if (!is.null(df) && !is.null(cols) && length(cols) > 0)
		for(col in cols)
			df[[col]] <- as.factor(df[[col]])

And got this warning message,

> source('D:/ambertuil.r')
Warning message:
In readLines(file) : incomplete final line found on 'D:/ambertuil.r'

Can you help with this?


Xiaobo Gu

More information about the R-help mailing list