I'm working on a project in which I need complex S4 objects with multiple layers of list. I'm wondering if this is a way to modify the @ function so that I can access data at the most granular level in an elegant way. To illustrate my problem, I created a sample S4 object below and my goal is to modify the @ function so I can achieve below:
jack <- new("Person", name = "Jack", other_info = list(age = 30, gender = "male")
jack@age
# 30
I have tried many other ways such as creating a generic function like %@% but dealing with operator precedence is extremely hard.