This is my sample code
library(spData)
world_asia = world[world$continent == "Asia", ]
asia = st_union(world_asia)
plot(world["pop"], reset = FALSE)
plot(asia, add = TRUE, col = "red")
The error I get is :
Error in polypath(p_bind(L), border = border[i], lty = lty[i], lwd = lwd[i], : plot.new has not been called yet
Someone please help me solve this basic problem. Could be more benefitting if u can explain why this error comes. thanks in advance
I found the answer. I was using the code in markdown chunk and was running the code line by line instead of running the entire chunk (ctrl+shift+enter)
Answer: run the entire chunk there wont be any problem.