types - Why does it appear in R that lapply is decaying integer64 to numeric and how can I avoid it? -


this question has answer here:

i'm not sure understand happening in following simple code snippet:

require(bit64) foo <- as.integer64(c(20,30,40)) foo #shows integer64 lapply(foo, class) #says numeric! 

why happening in call lapply? there way avoid it? internally in lapply function doing integer64 arithmetic , found breaking it..

something in guts of lapply doing it. instead, try applying on indices , calling function:

> lapply(1:length(foo),function(x){class(foo[x])}) [[1]] [1] "integer64"  [[2]] [1] "integer64"  [[3]] [1] "integer64" 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -