[R] incomplete final line found warning
Berend Hasselman
bhh at xs4all.nl
Sun Dec 11 12:29:27 CET 2011
Xiaobo.Gu wrote
>
> Hi,
>
> 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]])
> }
> }
> df
> }
>
> 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?
>
A warning message such as this could not be clearer.
It means that the last line of the file does not end with a <newline>
sequence ==> the final line of the file is incomplete.
In an editor go to the end of that line and press <Enter> or <Return>
And save.
Alternatively configure your editor to always terminate the last line of a
file with a <newline> sequence.
/Berend
--
View this message in context: http://r.789695.n4.nabble.com/incomplete-final-line-found-warning-tp4181838p4182612.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list