I am quite new to R and tried t do some data visualization in an R Markdown file. I got the following error when trying to create a piechart using the ggpie package:
Code: ggpie(mydataset, myvariable)
And I got the following error:
Error in PrepareData(data = data, group_key = group_key, count_type = count_type, : object 'myvariable' not found
The variable however exists. When I call mydataset$myvariable in the console, it exists.
When I change the code to ggpie(mydataset, mydataset$myvariable), I get the following Error:
Error in vectbl_as_col_location2()
:
! Must extract column with a single valid subscript.
✖ Subscript group_key
has size 80 but must be size 1.
Backtrace:
- ggpie::ggpie(mydataset, mydataset$myvariable)
- ggpie:::PrepareData(...)
- tibble:::
[[.tbl_df
(data, group_key) - tibble:::tbl_subset2(x, j = i, j_arg = substitute(i))
- tibble:::vectbl_as_col_location2(j, length(x), names(x), j_arg = j_arg)
- vctrs::vec_as_location2(j, n, names)
- vctrs:::result_get(...) Error in vectbl_as_col_location2(j, length(x), names(x), j_arg = j_arg) :
✖ Subscript group_key
has size 80 but must be size 1.
Any ideas? Thanks!