英文:
Attachments functions return "Error: attempt to apply non-function"
问题
我正在尝试将$list_attachments()和$download_attachment()都应用于我的Outlook对象,但它们都返回相同的错误。 代码很简单:
email <- my_outlook$list_emails(n = 1)
email2 <- email$list_attachments()
错误:尝试应用非函数
email2 <- email$download_attachment()
错误:尝试应用非函数
有什么想法是怎么回事?
英文:
I'm trying to apply both $list_attachments() and $download_attachment() to my outlook object but they return the same error. The code is straight forward:
email <- my_outlook$list_emails(n = 1)
email2 <- email$list_attachments()
Error: attempt to apply non-function
email2 <- email$download_attachment()
Error: attempt to apply non-function
Any ideas of what's going on?
答案1
得分: 1
感谢 @user20650 的评论,我已经确定问题所在。问题出在对象的结构上,它是一个列表。需要明确指定级别,以便函数能够使用正确的元素,如下所示:
email[[1]]$list_attachments()
英文:
Thanks to @user20650's comment I've identified the problem. It's the structure of the object, which is a list. The level needs to be stated so the function can work with the right element, like so:
email[[1]]$list_attachments()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论