Somewhere in between the R-Versions 2.6 and 2.7 the behaviour of the function type.convert and therefore also read.table, read.csv, etc. has changed (see below):

In 2.6 and before:
> type.convert(c("+", "-", "+"))
[1] + - +
Levels: + -

In 2.7 and later:
> type.convert(c("+", "-", "+"))
[1] 0 0 0

Apparently, the character strings "+" and "-" are now interpreted as numeric and not any more as factors or character strings.

I have quite a number of files with columns that contain "+" or "-" and would like to convert these to characters or factors, without having to specify the individual column types manually.

Is there any way to still do so in a new version of R?

Many thanks and best wishes,
Tim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to