尝试在plotly上绘制频率/时间线图时,我收到以下消息:
Error in if (has_group(trace)) tryNULL(dplyr::group_vars(dat)) :
missing value where TRUE/FALSE needed
这是我当前正在绘制的代码和数据框:
`Week beginning` <-as.Date(c("2015-01-05", "2015-01-12", "2015-01-19", "2015-01-26", "2015-02-02", "2015-02-09", "2015-02-16", "2015-02-23", "2015-03-02", "2015-03-09"))
Freq <- as.integer(c(2,5,1,5,5,1,2,2,3,2))
df <- data.frame(`Week beginning`, Freq)
FreqByWeek <- plot_ly(df, x= ~`Week beginning`) %>%
add_trace(y =~`Freq`, type = "scatter", modes ="lines")
FreqByWeek
我正在尝试将该图绘制为HTML文件。错误出现在我尝试打印绘图的最后一行。我要去哪里错了?
谢谢!