显然'object.size'函数只接受一个参数(即object),但不接受'units'或任何其他参数。我该如何解决它?
如果我尝试的话会发生什么:
object.size(averageBySubAct, units = "Mb")
Error in object.size(averageBySubAct, units = "Mb") :
unused argument (units = "Mb")
答案 0 :(得分:5)
?object.size
这给出了
object.size(x)
## S3 method for class 'object_size'
format(x, units = "b", ...)
## S3 method for class 'object_size'
print(x, quote = FALSE, units = "b", ...)
请注意object.size()
只接受一个参数x
。但是,我们可以打印object.size(x)
的结果,然后使用units
参数(如评论中所述)
print(object.size(c(5,6,1)), units="Mb")
# 0 Mb