0

Maybe someone can tell me why I'm getting an error

Error in if (df.name %in% dfs) { : the condition has length > 1

while trying to plot pie chart using function PieChart from lessR package? Here's a code I'm trying

PieChart(level, values = "%", color = "white", data = as.data.frame(mutate(data, level = case_when(`param num` < 10 ~ "low", `param num` >= 10 ~ "high"))), fill = c("blue", "violet"))

I used to run this code before and it was fine but I've changed laptop and reinstalled R & RStudio. But I'm opening the original folder with project that I had on old laptop. So that can't be the issue, can it?

Update. Example for iris dataset - getting the same mistake

library(lessR)
PieChart(sepal.length.level, values = "%", color = "white", data = as.data.frame(mutate(iris, sepal.length.level = case_when(Sepal.Length < 6 ~ "low", Sepal.Length >= 6 ~ "high"))), fill = c("orange", "green"))
Alexandra
  • 1
  • 1
  • 2
    Welcome to SO! You maximise your chance of getting a useful answer if you provide a minimal reproducible example. [This post](https://stackoverflow.com/help/minimal-reproducible-example) may help. – Limey Jun 03 '22 at 07:29
  • @Limey I've updated the question, please take a look – Alexandra Jun 03 '22 at 08:16
  • Does this answer your question? [beautiful Pie Charts with R](https://stackoverflow.com/questions/33594642/beautiful-pie-charts-with-r) – Limey Jun 03 '22 at 08:40
  • A pie chart [may not be your best option](https://www.data-to-viz.com/caveat/pie.html). – Limey Jun 03 '22 at 08:40
  • I want a pie chart exactly. And I like the way it was, just what I needed. Now I have a error, and my question is how to fix that error. not what plot should I build. – Alexandra Jun 03 '22 at 09:36
  • My link to "beautiful pie charts in R" should give you your solution. My link to the disadvantages of pie charts was purely advisory. You are, of course, free to ignore it if you wish. – Limey Jun 03 '22 at 09:39

0 Answers0