0

I have a list like

a=
:x1
..$y: chr [1:100] "da" "da" "dw" "dw"...........
..$z: num [1:100] 1 3 7 10 14 15 16...........
:x2
..$y chr [1:150] "sdd" "gtr" "fr" "sw"........
..$z num [1:150] 1 2 3 7 10 15 16............

i want to create a list which is a split of current list in a way that z vector should be split between 1:10, 11:20, 21:30,......

for eg.

a1=
:list1
..$x1
.. ..$y: chr [1:10] "da" "da"...........
.. ..$z: num [1:10] 1 3 7 10 ...........
..$x2
.. ..$y chr [1:10] "sdd" "gtr"........
.. ..$z num [1:10] 1 2 3 7 10............
:list2    
..$x1
.. ..$y: chr [1:10] "des" "ded"...........
.. ..$z: num [1:10] 14 15 16...........
..$x2
.. ..$y chr [1:10] "dwd" "ded"........
.. ..$z num [1:10] 15 16............
:list3    
..$x1
.. ..$y: chr [1:10] "ded" "sa"...........
.. ..$z: num [1:10] 21 24 27...........
..$x2
.. ..$y chr [1:10] "dww" "dw"........
.. ..$z num [1:10] 24 27 30............

I am trying some for loop but is throwing some errors.

0 Answers0