问题描述
我正在尝试将 ggplot 对象保存在 S4 插槽中。
考虑:
library(stats4)
library(ggplot2)
setClass("gginS4",contains = c("ggplot"),slots = c(
p = "ggplot"))
允许通过 gginS4@p
访问 ggplot。我已经将这种方法用于其他类别的数据(即“sf”等),没有问题。但是,上面的示例会产生以下错误:
Error in reconcilePropertiesAndPrototype(name,slots,prototype,superClasses,:
no definition was found for superclass “ggplot” in the specification of class “gginS4”
用 ggplot2::ggplot()
创建的对象有两个类 gg
和 ggplot
,但是 setClass()
找不到这两个超类的定义。还有另一种定义槽的方法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)