From the error we can see that sort
function has issues with list
input. Testing this case for a sample list
templist<-list(c(3,2,1))
> sort(templist)
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
newlist<-unlist(templist)
>is.atomic(newlist)
[1] TRUE
> sort(newlist)
[1] 1 2 3
The key here is unlist
, You can confirm if your inputs ls1
and ls2
are list
(s) using, rpy.r.is.list
. To unlist them, rpy.r.unlist
needs to be called on both ls1
and ls2
.
To be able use functions with .
in the function name such as is.list()
, you could refer to (Accessing functions with a dot in theior name (eg. "as.vector") using rpy2)
I do not have rpy hence cannot confirm but I suppose this should work, let us know.