Hi, Given the following R code:
library(pryr) data <- array(dim = c(5)) for(x in 1:5) { data[x] <- as.integer(x * 2) } add = address(data) # save address of "data" for(x in 1:5) { data[x] <- as.integer(0) } if (add == address(data)) { print("Address did not change") } else { print("Address changed") } If one runs this code, message "Address changed" is printed. However, if one comments line "data[x] <- as.integer(0)" the address of "data" does not change and message "Address did not change" is printed instead. Why? The datatype of the array should not change with this line and hence no need for R to convert the array to a different type (and have the array's address changing in the process). Thank you! ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel