среда, 26 января 2011 г.

конвертация переменных: фактор >> численная

при чтении файла R может сам определять типы данных, это не есть гутт, поэтому вот рекомендация:

How do I convert factors to numeric?

It may happen that when reading numeric data into R (usually, when reading in a file), they come in as factors. If f is such a factor object, you can use
as.numeric(as.character(f))
to get the numbers back. More efficient, but harder to remember, is
as.numeric(levels(f))[as.integer(f)]
In any case, do not call as.numeric() or their likes directly for the task at hand (as as.numeric() or unclass() give the internal codes).

Однако, думаю, есть возможность обдурить пакет на стадии подгтоовки файла

для R учреждена отдельная кафедра

Комментариев нет:

Отправить комментарий