我正在尝试使用highcharter
库在 R 中绘制条形图
我的数据框mostly_used
看起来像这样:
word n
1 sir 8484
2 time 7339
3 miss 5954
4 dear 5422
5 hand 5305
6 head 4978
7 night 4240
8 day 4124
9 eyes 4040
10 house 4011
我使用以下代码行:
hchart(mostly_used, x = word, y = n, type = "column", name = "word count"
, color = "blue") %>% hc_add_theme(hc_theme_null())
我得到错误Error: Columns`x`, `y` must be 1d atomic vectors or lists
谁能解释这是为什么?
编辑:
> dput(mostly_used)
structure(list(word = c("sir", "time", "miss", "dear", "hand",
"head", "night", "day", "eyes", "house"), n = c(8484L, 7339L,
5954L, 5422L, 5305L, 4978L, 4240L, 4124L, 4040L, 4011L)), .Names = c("word",
"n"), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"
))