Knitting my File produces the error message down below:
This is how my File starts:
Unfortunately, I couldn't try anything as I have no idea what the error message has to do with the displayed information.
I hope to knit the document to a pdf once this error has been removed.
My code:
library(plotrix)
p6<-pie3D(rawdata8.2$rawdata8.1,
col = hcl.colors(length(data), "Spectral"),
radius = 1.7,
theta = 0.25,
shade = 0.5,
height = 0.3,
start = pi/1.25,
explode = 0.2)
title("Anzahl Ankünfte nach Herkunftsland der Touristen 2020" )
The most obvious problem is that you are probably asking for a palette of length 1:
This happens because
hcl.colors
tries to set up a step size-2/(n-1)
, which is infinite ifn==1
.Guessing beyond this what's going on: unless you have explicitly defined an object called
data
in your workspace, R will find the built-in functiondata()
:length(data)
is 1 (as it seems all functions have length 1 - not quite sure what the logic is here ...)Also keep in mind that if you have a data frame
df
,length(df)
will give you the number of columns — you would neednrow(df)
to get the number of rows ...