离线使用 plotly r 包时关于用户名的错误信息

Error message about username when using plotly r package offline

我正在尝试开始为 R 使用 plotly,但我遇到了有关用户名的错误。当我尝试执行以下代码时...

test=ggplot(diamonds,aes(x=diamonds$carat,y=diamonds$price))+geom_point()
test2=plotly(test)
plotly(test)

...我收到错误消息:

Storing 'username' as the environment variable 'plotly_username'
Error in Sys.setenv(plotly_username = username) : 
  wrong length for argument

我认为 plotly 的 R 包可以通过 htmlwidgets 在没有用户名的情况下使用。据我所知,我使用的是最新版本的 plotly、ggplot 和 htmlwidgets。我究竟做错了什么?

你必须使用ggplotly()

所以,

test <- ggplot(diamonds,aes(x = carat,y = price))+ geom_point()

ggplotly(test)