I have a piece of code in R. Every time I run it on a cluster, I get an answer where the order of columns are different. (It seems to be OK on my laptop). If I order the column so they have the same order, answers are identical, the only problem is ordering of the columns.
{NNs_loc_year <- Reduce(cbind,
split(NNs_loc_year,
rep(1:n_neighbors, each=(nrow(NNs_loc_year)/n_neighbors)))) %>%
data.table()
# rename columns
NN_dist <- NN_dist %>% data.table()
names(NN_dist) <- paste0("NN_", c(1:n_neighbors))
names(NNs_loc_year) <- paste0(names(NNs_loc_year), paste0("_NN_", rep(1:n_neighbors, each=2)))
NN_chi <- pchi(as.vector(NN_list$nn.dist), PCs)
NN_sigma <- qchi(NN_chi, 1)
NN_sigma_df = Reduce(cbind,
split(NN_sigma,
rep(1:n_neighbors, each=(length(NN_sigma)/n_neighbors)))) %>%
data.table()
names(NN_sigma_df) <- paste0("sigma_NN_", c(1:n_neighbors))
NN_dist_tb = rbind(NN_dist_tb, NN_dist)
NNs_loc_year_tb = rbind(NNs_loc_year_tb, NNs_loc_year)
NN_sigma_tb = rbind(NN_sigma_tb, NN_sigma_df)}
Aucun commentaire:
Enregistrer un commentaire