As pointed out in this question and copious official & unofficial R documentation,
x <- complex(15)
dim(x) == NULL
For me it's annoying to have to write a separate method (or if
clause) for atomic vectors rather than being able to use dim(x)[1]
. Would it be stupid to recode dim
(a primitive) so it automatically returns length
if dim(x)==NULL
?
To be a bit more concrete: Are popular packages going to break if I recode dim
in let's say my .Rprofile
? Is this stupid for another reason I'm not seeing?