I have a sage list of list of list that is the result of some function applied over an R list of list of list (converted to sage format)
The code goes like this:
%r
my_r_list<-load("my_r_list.RData")
for d in range(D):
for s in range(S):
for c in range(C):
my_sage_list[d][s][c] = ("my_r_list")[[d+1]][[s+1]][[c+1]]._sage_()
output_my_sage_list[d][s][c] = some_function(my_sage_list[d][s][c])
I would like to convert output_my_sage_list
back into an R list so as to save it into an .RData
file
Documentation on interface Sage with R is mainly about going from R to Sage but not the other way around.This question concerns converting a sagemath matrix to R matrix using r.matrix()' so i tried using 'r.list()' but with no luck. I also tried the simple
output_my_r_list = r(output_my_sage_list)which gives no error but the output is not correct as doing
output_my_r_list[0][0]` doesn't give the last level of list but directly some values.
A reproducible code (bypassing the R to Sage part) would be:
output_d = [[] for _ in range(9)]
for d in range(9):
output_s = [[] for _ in range(4)]
output_d[d] = output_s
for s in range(4):
output_c = [[] for _ in range(2)]
output_s[s] = output_c
for k in range(2):
res = random()
output_c[k] = res
I would like to convert output_d
to an R list