I would like to know if there is a more efficient way to do this since I have a millions-long dataset that has been stuck for days in this step.
for (i in 1:32000000){
if (!exists("df")){
df <- as.data.frame(Properties[[i]])
df <- as.data.frame(t(df))
}else{
temp_dataset <- as.data.frame(Properties[[i]])
temp_dataset <- as.data.frame(t(temp_dataset))
df <- rbind(df, temp_dataset)
rm(temp_dataset)
}
}
Basically what is doing is to create a new variable and add new rows as the variable i
progress through 1:32000000
. But, as I said it takes a lot of time so I need a more efficient way to do it.
Properties
looks like:
List of 32000000
$ : Named num [1:3] -0.85 -0.544 0.208
..- attr(*, "names")= chr [1:3] "PP1" "PP2" "PP3"
$ : Named num [1:3] -0.332 -0.698 0.264
..- attr(*, "names")= chr [1:3] "PP1" "PP2" "PP3"
$ : Named num [1:3] -0.768 -0.486 0.184
..- attr(*, "names")= chr [1:3] "PP1" "PP2" "PP3"
$ : Named num [1:3] -0.458 -0.57 -0.054
..- attr(*, "names")= chr [1:3] "PP1" "PP2" "PP3"
$ : Named num [1:3] -0.536 -0.458 0.348
..- attr(*, "names")= chr [1:3] "PP1" "PP2" "PP3"
$ : Named num [1:3] -0.47 -0.776 0.06