Suharto Anggono Suharto Anggono
2013-May-20 06:39 UTC
[Rd] is.vector(as.vector(data.frame(a=1))) and is.vector(as.vector(call("c"))) are FALSE
These are deviations from the convention: ?is.vector(as.vector(x, m), m)? should be true for any mode ?m?, including the default ?"any"?. * Case 1 These are documented. - ?is.vector? returns ?TRUE? if ?x? is a vector of the specified mode having no attributes _other than names_. It returns ?FALSE? otherwise. - ?as.vector? removes _all_ attributes including names for results of atomic mode (but not those of mode ?"list"? nor ?"expression"?). Because of the quirk of 'as.vector' for result of mode "list", is.vector(as.vector(data.frame(a=1))) returns FALSE.> is.vector(as.vector(data.frame(a=1)))[1] FALSE> is.vector(as.vector(data.frame(a=1), "list"), "list")[1] FALSE * Case 2 as.vector(call("c")) (mode="any", the default) is not an error. On the other hand, as documented, if ?mode = "any"?, ?is.vector? may return ?TRUE? for the atomic modes, ?list? and ?expression?. As a result, is.vector(as.vector(call("c"))) returns FALSE.> is.vector(as.vector(call("c")))[1] FALSE> sessionInfo()R version 3.0.1 (2013-05-16) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base