【发布时间】:2018-02-27 18:05:48
【问题描述】:
以下代码产生错误:
setClass(Class ='Foo', slots=c(field_1='character', field_2 = 'character' ))
list_of_obj <- c(new('Foo', field_1 = 'bar', field_2 = 'foo_bar'))
list_of_obj[1]@field_1
Error: trying to get slot "field_1" from an object of a basic class ("list") with no slots
如何访问存储在列表中的对象中的插槽field_1?
【问题讨论】: