Wednesday, February 16, 2011

str и тип данных

Насколько я понимаю, тип данных можно посмотреть функцией str
(Это я почитываю A handbook of statistical analyses using R / Brian S. Everitt and Torsten Hothorn)

Two functions are helpful for getting an overview about R objects:
str and;
summary,
where str is more detailed about data types and summary gives a collection of sensible summary statistics.

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

выход str:

 $ CM11Y   : atomic  1976 2004 2005 2003 1993 ...
  ..- attr(*, "value.labels")= Named num  9999 9998 9997
  .. ..- attr(*, "names")= chr  "Missing" "DK" "Inconsistent"
 $ CM12    : Factor w/ 3 levels "","No","Yes": 2 3 3 2 2 2 2 2 1 1 ...
$ CM11Y -- год
$ CM12 -- тут на самом деле бинарная должна быть, а в исходнике continuous, хотя R интерпретировал верно

упг:
вот что пишет R Language Definition Version 2.12.1 (2010-12-16) DRAFT: R has six basic (‘atomic’) vector types: logical, integer, real, complex, string (or character) and raw. The modes and storage modes for the different vector types are listed in the following table.

2.1.2 Lists
Lists (“generic vectors”) are another kind of data storage. Lists have elements, each of which
can contain any type of R object, i.e. the elements of a list do not have to be of the same type. List elements are accessed through three different indexing operations. These are explained in< detail in Section 3.4 [Indexing], page 15.

Lists are vectors, and the basic vector types are referred to as atomic vectors where it is<
necessary to exclude lists.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.