Displaying 1 result from an estimated 1 matches for "352033".
Did you mean:
35033
2009 Nov 26
3
Best way to preallocate numeric NA array?
These are the ways that occur to me.
## This produces a logical vector, which will get converted to a numeric
## vector the first time a number is assigned to it. That seems
## wasteful.
x <- rep(NA, n)
## This does the conversion ahead of time but it's still creating a
## logical vector first, which seems wasteful.
x <- as.numeric(rep(NA, n))
## This avoids type conversion but still